summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJack Moffitt <jack@xiph.org>2000-09-26 18:45:34 +0000
committerJack Moffitt <jack@xiph.org>2000-09-26 18:45:34 +0000
commit6b1c05146cd4611066d0b0da7dc85ae6d0bc71f6 (patch)
treecf0de27c737fac3b7ba24efa4139b7ee4ed59206
parentd93447fd03a23a8e527d59c80a3127fbd3afaeb9 (diff)
downloadlibvorbis-git-branch_jackoggsvorbis.tar.gz
frameno -> granuleposbranch_jackoggsvorbis
library version fixes svn path=/branches/branch_jackoggsvorbis/vorbis/; revision=689
-rw-r--r--configure.in11
-rw-r--r--include/vorbis/codec.h6
-rw-r--r--lib/Makefile.am2
-rw-r--r--lib/analysis.c4
-rw-r--r--lib/block.c30
-rw-r--r--lib/envelope.c18
-rw-r--r--lib/floor0.c10
-rw-r--r--lib/info.c8
-rw-r--r--lib/psytune.c28
-rw-r--r--lib/synthesis.c4
-rw-r--r--lib/vorbisfile.c30
11 files changed, 80 insertions, 71 deletions
diff --git a/configure.in b/configure.in
index 47e8ded9..db4c1aa5 100644
--- a/configure.in
+++ b/configure.in
@@ -1,12 +1,21 @@
dnl Process this file with autoconf to produce a configure script
dnl ------------------------------------------------
-dnl Initialization
+dnl Initialization and Versioning
dnl ------------------------------------------------
AC_INIT(lib/mdct.c)
AM_INIT_AUTOMAKE(libvorbis,1.0.0)
+dnl Library versioning
+
+LIB_CURRENT=0
+LIB_REVISION=0
+LIB_AGE=0
+AC_SUBST(LIB_CURRENT)
+AC_SUBST(LIB_REVISION)
+AC_SUBST(LIB_AGE)
+
dnl --------------------------------------------------
dnl Check for programs
dnl --------------------------------------------------
diff --git a/include/vorbis/codec.h b/include/vorbis/codec.h
index cd853e6f..ec9ed656 100644
--- a/include/vorbis/codec.h
+++ b/include/vorbis/codec.h
@@ -12,7 +12,7 @@
********************************************************************
function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.27.2.2.2.2 2000/09/03 08:34:51 jack Exp $
+ last mod: $Id: codec.h,v 1.27.2.2.2.3 2000/09/26 18:45:32 jack Exp $
********************************************************************/
@@ -171,7 +171,7 @@ typedef struct vorbis_dsp_state{
long nW;
long centerW;
- ogg_int64_t frameno;
+ ogg_int64_t granulepos;
ogg_int64_t sequence;
ogg_int64_t glue_bits;
@@ -219,7 +219,7 @@ typedef struct vorbis_block{
int mode;
int eofflag;
- ogg_int64_t frameno;
+ ogg_int64_t granulepos;
ogg_int64_t sequence;
vorbis_dsp_state *vd; /* For read-only access of configuration */
diff --git a/lib/Makefile.am b/lib/Makefile.am
index fd08d39e..766f88a7 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -12,7 +12,7 @@ libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c lpc.c\
iir.c vorbisfile.c\
envelope.h lpc.h lsp.h bookinternal.h misc.h psy.h\
masking.h sharedbook.h iir.h os.h
-libvorbis_la_LDFLAGS = -version-info 1:0:0
+libvorbis_la_LDFLAGS = -version-info @LIB_CURRENT@:@LIB_REVISION@:@LIB_AGE@
debug:
$(MAKE) all CFLAGS="@DEBUG@"
diff --git a/lib/analysis.c b/lib/analysis.c
index 5171eb80..14304c8e 100644
--- a/lib/analysis.c
+++ b/lib/analysis.c
@@ -12,7 +12,7 @@
********************************************************************
function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.33.2.2.2.1 2000/09/03 08:34:51 jack Exp $
+ last mod: $Id: analysis.c,v 1.33.2.2.2.2 2000/09/26 18:45:33 jack Exp $
********************************************************************/
@@ -67,7 +67,7 @@ int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
op->bytes=oggpack_bytes(&vb->opb);
op->b_o_s=0;
op->e_o_s=vb->eofflag;
- op->frameno=vb->frameno;
+ op->granulepos=vb->granulepos;
op->packetno=vb->sequence; /* for sake of completeness */
return(0);
diff --git a/lib/block.c b/lib/block.c
index 8fdb1bcb..ae6cd778 100644
--- a/lib/block.c
+++ b/lib/block.c
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.38.2.2.2.1 2000/09/03 08:34:51 jack Exp $
+ last mod: $Id: block.c,v 1.38.2.2.2.2 2000/09/26 18:45:33 jack Exp $
Handle windowing, overlap-add, etc of the PCM vectors. This is made
more amusing by Vorbis' current two allowed block sizes.
@@ -512,7 +512,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
}
vb->vd=v;
vb->sequence=v->sequence;
- vb->frameno=v->frameno;
+ vb->granulepos=v->granulepos;
vb->pcmend=vi->blocksizes[v->W];
/* copy the vectors; this uses the local storage in vb */
@@ -559,12 +559,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
v->eofflag-=movementW;
/* do not add padding to end of stream! */
if(v->centerW>=v->eofflag){
- v->frameno+=movementW-(v->centerW-v->eofflag);
+ v->granulepos+=movementW-(v->centerW-v->eofflag);
}else{
- v->frameno+=movementW;
+ v->granulepos+=movementW;
}
}else{
- v->frameno+=movementW;
+ v->granulepos+=movementW;
}
}
@@ -578,7 +578,7 @@ int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
/* Adjust centerW to allow an easier mechanism for determining output */
v->pcm_returned=v->centerW;
v->centerW-= vi->blocksizes[v->W]/4+vi->blocksizes[v->lW]/4;
- v->frameno=-1;
+ v->granulepos=-1;
v->sequence=-1;
return(0);
@@ -622,7 +622,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
v->floor_bits+=vb->floor_bits;
v->res_bits+=vb->res_bits;
- if(v->sequence+1 != vb->sequence)v->frameno=-1; /* out of sequence;
+ if(v->sequence+1 != vb->sequence)v->granulepos=-1; /* out of sequence;
lose count */
v->sequence=vb->sequence;
@@ -673,7 +673,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
/* track the frame number... This is for convenience, but also
making sure our last packet doesn't end with added padding. If
the last packet is partial, the number of samples we'll have to
- return will be past the vb->frameno.
+ return will be past the vb->granulepos.
This is not foolproof! It will be confused if we begin
decoding at the last page after a seek or hole. In that case,
@@ -681,17 +681,17 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
is. For this reason, vorbisfile will always try to make sure
it reads the last two marked pages in proper sequence */
- if(v->frameno==-1)
- v->frameno=vb->frameno;
+ if(v->granulepos==-1)
+ v->granulepos=vb->granulepos;
else{
- v->frameno+=(centerW-v->centerW);
- if(vb->frameno!=-1 && v->frameno!=vb->frameno){
- if(v->frameno>vb->frameno && vb->eofflag){
+ v->granulepos+=(centerW-v->centerW);
+ if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
+ if(v->granulepos>vb->granulepos && vb->eofflag){
/* partial last frame. Strip the padding off */
- centerW-=(v->frameno-vb->frameno);
+ centerW-=(v->granulepos-vb->granulepos);
}/* else{ Shouldn't happen *unless* the bitstream is out of
spec. Either way, believe the bitstream } */
- v->frameno=vb->frameno;
+ v->granulepos=vb->granulepos;
}
}
diff --git a/lib/envelope.c b/lib/envelope.c
index 0eada7ab..2f4e030f 100644
--- a/lib/envelope.c
+++ b/lib/envelope.c
@@ -12,7 +12,7 @@
********************************************************************
function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.21.2.2.2.1 2000/09/03 08:34:52 jack Exp $
+ last mod: $Id: envelope.c,v 1.21.2.2.2.2 2000/09/26 18:45:33 jack Exp $
Preecho calculation.
@@ -115,16 +115,16 @@ static float _ve_deltai(envelope_lookup *ve,IIR_state *iir,
float *workB=alloca(sizeof(float)*n2),B=0.;
long i;
- /*_analysis_output("A",frameno,pre,n,0,0);
- _analysis_output("B",frameno,post,n,0,0);*/
+ /*_analysis_output("A",granulepos,pre,n,0,0);
+ _analysis_output("B",granulepos,post,n,0,0);*/
for(i=0;i<n;i++){
workA[i]=pre[i]*ve->window[i];
workB[i]=post[i]*ve->window[i];
}
- /*_analysis_output("Awin",frameno,workA,n,0,0);
- _analysis_output("Bwin",frameno,workB,n,0,0);*/
+ /*_analysis_output("Awin",granulepos,workA,n,0,0);
+ _analysis_output("Bwin",granulepos,workB,n,0,0);*/
drft_forward(&ve->drft,workA);
drft_forward(&ve->drft,workB);
@@ -140,8 +140,8 @@ static float _ve_deltai(envelope_lookup *ve,IIR_state *iir,
}
}
- /*_analysis_output("Afft",frameno,workA,n,0,0);
- _analysis_output("Bfft",frameno,workB,n,0,0);*/
+ /*_analysis_output("Afft",granulepos,workA,n,0,0);
+ _analysis_output("Bfft",granulepos,workB,n,0,0);*/
for(i=0;i<n;i++){
A+=workA[i]*workA[i];
@@ -191,10 +191,10 @@ long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
float m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered);
if(m>vi->preecho_thresh){
- /*frameno++;*/
+ /*granulepos++;*/
return(0);
}
- /*frameno++;*/
+ /*granulepos++;*/
}
j+=vi->blocksizes[0]/2;
diff --git a/lib/floor0.c b/lib/floor0.c
index 3587ee1b..36954867 100644
--- a/lib/floor0.c
+++ b/lib/floor0.c
@@ -12,7 +12,7 @@
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.23.2.3.2.1 2000/09/03 08:34:52 jack Exp $
+ last mod: $Id: floor0.c,v 1.23.2.3.2.2 2000/09/26 18:45:33 jack Exp $
********************************************************************/
@@ -179,7 +179,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
not bottlenecked here anyway */
float _curve_to_lpc(float *curve,float *lpc,
- vorbis_look_floor0 *l,long frameno){
+ vorbis_look_floor0 *l,long granulepos){
/* map the input curve to a bark-scale curve for encoding */
int mapped=l->ln;
@@ -228,7 +228,7 @@ float _curve_to_lpc(float *curve,float *lpc,
char buffer[80];
int i;
- sprintf(buffer,"Fmask_%d.m",frameno);
+ sprintf(buffer,"Fmask_%d.m",granulepos);
of=fopen(buffer,"w");
for(i=0;i<mapped;i++)
fprintf(of,"%g\n",work[i]);
@@ -242,7 +242,7 @@ float _curve_to_lpc(float *curve,float *lpc,
/* generate the whole freq response curve of an LSP IIR filter */
void _lsp_to_curve(float *curve,float *lsp,float amp,
- vorbis_look_floor0 *l,char *name,long frameno){
+ vorbis_look_floor0 *l,char *name,long granulepos){
/* l->m+1 must be less than l->ln, but guard in case we get a bad stream */
float *lcurve=alloca(sizeof(float)*l->ln);
int i;
@@ -258,7 +258,7 @@ void _lsp_to_curve(float *curve,float *lsp,float amp,
}
void s_lsp_to_curve(float *curve,float *lsp,float amp,
- vorbis_look_floor0 *l,char *name,long frameno,
+ vorbis_look_floor0 *l,char *name,long granulepos,
float ampdB){
/* l->m+1 must be less than l->ln, but guard in case we get a bad stream */
float *lcurve=alloca(sizeof(double)*l->ln);
diff --git a/lib/info.c b/lib/info.c
index be2b7b37..370d8611 100644
--- a/lib/info.c
+++ b/lib/info.c
@@ -12,7 +12,7 @@
********************************************************************
function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.30.4.1 2000/09/03 08:34:52 jack Exp $
+ last mod: $Id: info.c,v 1.30.4.2 2000/09/26 18:45:33 jack Exp $
********************************************************************/
@@ -509,7 +509,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
op->bytes=oggpack_bytes(&opb);
op->b_o_s=1;
op->e_o_s=0;
- op->frameno=0;
+ op->granulepos=0;
/* second header packet (comments) **********************************/
@@ -523,7 +523,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
op_comm->bytes=oggpack_bytes(&opb);
op_comm->b_o_s=0;
op_comm->e_o_s=0;
- op_comm->frameno=0;
+ op_comm->granulepos=0;
/* third header packet (modes/codebooks) ****************************/
@@ -537,7 +537,7 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
op_code->bytes=oggpack_bytes(&opb);
op_code->b_o_s=0;
op_code->e_o_s=0;
- op_code->frameno=0;
+ op_code->granulepos=0;
oggpack_writeclear(&opb);
return(0);
diff --git a/lib/psytune.c b/lib/psytune.c
index ecc83ff3..2d329bba 100644
--- a/lib/psytune.c
+++ b/lib/psytune.c
@@ -13,7 +13,7 @@
function: simple utility that runs audio through the psychoacoustics
without encoding
- last mod: $Id: psytune.c,v 1.6.2.1 2000/08/31 09:00:01 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.6.2.1.2.1 2000/09/26 18:45:34 jack Exp $
********************************************************************/
@@ -151,11 +151,11 @@ typedef struct {
} vorbis_look_floor0;
extern float _curve_to_lpc(float *curve,float *lpc,vorbis_look_floor0 *l,
- long frameno);
+ long granulepos);
extern void _lsp_to_curve(float *curve,float *lpc,float amp,
- vorbis_look_floor0 *l,char *name,long frameno);
+ vorbis_look_floor0 *l,char *name,long granulepos);
-long frameno=0;
+long granulepos=0;
/* hacked from floor0.c */
static void floorinit(vorbis_look_floor0 *look,int n,int m,int ln){
@@ -283,7 +283,7 @@ int main(int argc,char *argv[]){
for(i=0;i<2;i++){
float amp;
- analysis("pre",frameno,pcm[i],framesize,0,0);
+ analysis("pre",granulepos,pcm[i],framesize,0,0);
/* do the psychacoustics */
for(j=0;j<framesize;j++)
@@ -291,25 +291,25 @@ int main(int argc,char *argv[]){
mdct_forward(&m_look,pcm[i],pcm[i]);
- analysis("mdct",frameno,pcm[i],framesize/2,1,1);
+ analysis("mdct",granulepos,pcm[i],framesize/2,1,1);
_vp_compute_mask(&p_look,pcm[i],floor,decay[i]);
- analysis("prefloor",frameno,floor,framesize/2,1,1);
- analysis("decay",frameno,decay[i],framesize/2,1,1);
+ analysis("prefloor",granulepos,floor,framesize/2,1,1);
+ analysis("decay",granulepos,decay[i],framesize/2,1,1);
for(j=0;j<framesize/2;j++)floor[j]=todB(floor[j])+150;
- amp=_curve_to_lpc(floor,lpc,&floorlook,frameno);
+ amp=_curve_to_lpc(floor,lpc,&floorlook,granulepos);
vorbis_lpc_to_lsp(lpc,lpc,order);
- _lsp_to_curve(floor,lpc,sqrt(amp),&floorlook,"Ffloor",frameno);
+ _lsp_to_curve(floor,lpc,sqrt(amp),&floorlook,"Ffloor",granulepos);
for(j=0;j<framesize/2;j++)floor[j]=fromdB(floor[j]-150);
- analysis("floor",frameno,floor,framesize/2,1,1);
+ analysis("floor",granulepos,floor,framesize/2,1,1);
_vp_apply_floor(&p_look,pcm[i],floor);
/*r(j=0;j<framesize/2;j++)
if(fabs(pcm[i][j])<1.)pcm[i][j]=0;*/
- analysis("quant",frameno,pcm[i],framesize/2,1,1);
+ analysis("quant",granulepos,pcm[i],framesize/2,1,1);
/* re-add floor */
for(j=0;j<framesize/2;j++){
@@ -324,14 +324,14 @@ int main(int argc,char *argv[]){
}
}
- analysis("final",frameno,pcm[i],framesize/2,1,1);
+ analysis("final",granulepos,pcm[i],framesize/2,1,1);
/* take it back to time */
mdct_backward(&m_look,pcm[i],pcm[i]);
for(j=0;j<framesize/2;j++)
out[i][j]+=pcm[i][j]*window[j];
- frameno++;
+ granulepos++;
}
/* write data. Use the part of buffer we're about to shift out */
diff --git a/lib/synthesis.c b/lib/synthesis.c
index bd36170a..4ed6b372 100644
--- a/lib/synthesis.c
+++ b/lib/synthesis.c
@@ -12,7 +12,7 @@
********************************************************************
function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.17.4.1.2.1 2000/09/03 08:34:52 jack Exp $
+ last mod: $Id: synthesis.c,v 1.17.4.1.2.2 2000/09/26 18:45:34 jack Exp $
********************************************************************/
@@ -55,7 +55,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
}
/* more setup */
- vb->frameno=op->frameno;
+ vb->granulepos=op->granulepos;
vb->sequence=op->packetno-3; /* first block is third packet */
vb->eofflag=op->e_o_s;
diff --git a/lib/vorbisfile.c b/lib/vorbisfile.c
index b7c80cfb..026cbd9c 100644
--- a/lib/vorbisfile.c
+++ b/lib/vorbisfile.c
@@ -12,7 +12,7 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.27.2.2 2000/08/31 09:00:02 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.27.2.2.2.1 2000/09/26 18:45:34 jack Exp $
********************************************************************/
@@ -306,9 +306,9 @@ static void _prefetch_all_headers(OggVorbis_File *vf,vorbis_info *first_i,
vorbis_comment_clear(vf->vc+i);
break;
}
- if(ogg_page_frameno(&og)!=-1){
+ if(ogg_page_granulepos(&og)!=-1){
vf->serialnos[i]=ogg_page_serialno(&og);
- vf->pcmlengths[i]=ogg_page_frameno(&og);
+ vf->pcmlengths[i]=ogg_page_granulepos(&og);
break;
}
}
@@ -413,14 +413,14 @@ static int _process_packet(OggVorbis_File *vf,int readp){
if(vf->decode_ready){
ogg_packet op;
int result=ogg_stream_packetout(&vf->os,&op);
- ogg_int64_t frameno;
+ ogg_int64_t granulepos;
/* if(result==-1)return(-1); hole in the data. For now, swallow
and go. We'll need to add a real
error code in a bit. */
if(result>0){
/* got a packet. process it */
- frameno=op.frameno;
+ granulepos=op.granulepos;
if(!vorbis_synthesis(&vf->vb,&op)){ /* lazy check for lazy
header handling. The
header packets aren't
@@ -438,7 +438,7 @@ static int _process_packet(OggVorbis_File *vf,int readp){
}
/* update the pcm offset. */
- if(frameno!=-1 && !op.e_o_s){
+ if(granulepos!=-1 && !op.e_o_s){
int link=(vf->seekable?vf->current_link:0);
int i,samples;
@@ -449,18 +449,18 @@ static int _process_packet(OggVorbis_File *vf,int readp){
As an aside, this trick is inaccurate if we begin
reading anew right at the last page; the end-of-stream
- frameno declares the last frame in the stream, and the
+ granulepos declares the last frame in the stream, and the
last packet of the last page may be a partial frame.
- So, we need a previous frameno from an in-sequence page
+ So, we need a previous granulepos from an in-sequence page
to have a reference point. Thus the !op.e_o_s clause
above */
samples=vorbis_synthesis_pcmout(&vf->vd,NULL);
- frameno-=samples;
+ granulepos-=samples;
for(i=0;i<link;i++)
- frameno+=vf->pcmlengths[i];
- vf->pcm_offset=frameno;
+ granulepos+=vf->pcmlengths[i];
+ vf->pcm_offset=granulepos;
}
return(1);
}
@@ -766,7 +766,7 @@ int ov_raw_seek(OggVorbis_File *vf,long pos){
/* we need to make sure the pcm_offset is set. We use the
_fetch_packet helper to process one packet with readp set, then
call it until it returns '0' with readp not set (the last packet
- from a page has the 'frameno' field set, and that's how the
+ from a page has the 'granulepos' field set, and that's how the
helper updates the offset */
switch(_process_packet(vf,1)){
@@ -851,9 +851,9 @@ int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
if(ret==-1){
end=bisect;
}else{
- ogg_int64_t frameno=ogg_page_frameno(&og);
- if(frameno<target){
- best=ret; /* raw offset of packet with frameno */
+ ogg_int64_t granulepos=ogg_page_granulepos(&og);
+ if(granulepos<target){
+ best=ret; /* raw offset of packet with granulepos */
begin=vf->offset; /* raw offset of next packet */
}else{
end=bisect;