[xiph-cvs] cvs commit: vorbis/lib vorbisfile.c
Monty
xiphmont at xiph.org
Thu Feb 15 09:16:06 PST 2001
xiphmont 01/02/15 09:16:06
Modified: lib vorbisfile.c
Log:
Reverting vorbisfile.c to the known stable 1.37 version for the beta 4
release. Nicholas's optimization, though fundamentally sound, has a
subtle rep-invariant bug or two that will break other functions and I
want a known working version for the allegedly stable beta. Nick's
version will go back on mainline (with a few more tweaks) right after
beta 4 tagging.
Monty
Revision Changes Path
1.40 +0 -105 vorbis/lib/vorbisfile.c
Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- vorbisfile.c 2001/02/14 13:24:29 1.39
+++ vorbisfile.c 2001/02/15 17:16:05 1.40
@@ -11,7 +11,7 @@
********************************************************************
function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.39 2001/02/14 13:24:29 msmith Exp $
+ last mod: $Id: vorbisfile.c,v 1.40 2001/02/15 17:16:05 xiphmont Exp $
********************************************************************/
@@ -847,28 +847,6 @@
return OV_EBADLINK;
}
-int ov_raw_seek_fast(OggVorbis_File *vf, long pos, int offset, int link) {
- int ret;
- ogg_page og;
- if(!vf->seekable)return(OV_ENOSEEK); /* Don't dump machine, this is ok. */
-
- if(pos<0 || pos>vf->offsets[vf->links])return(OV_EINVAL);
-
- /* Clear decode state */
- vf->pcm_offset=-1;
- _decode_clear(vf);
-
- /* Do the seek */
- _seek_helper(vf,pos);
- ret = _get_next_page(vf,&og,vf->offsets[link+1]-vf->offset);
- if(ret<0)
- return ret;
- vf->pcm_offset = offset;
-
- return 0;
-}
-
-
/* Page granularity seek (faster than sample granularity because we
don't do the last bit of decode to find a specific sample).
@@ -894,88 +872,6 @@
missing pages or incorrect frame number information in the
bitstream could make our task impossible. Account for that (it
would be an error condition) */
- /* Faster/more intelligent version from Nicholas Vinen */
-
- {
- ogg_int64_t target=pos-total;
- long end=vf->offsets[link+1];
- long begin=vf->offsets[link];
- ogg_int64_t endtime = vf->pcmlengths[link];
- ogg_int64_t begintime=0;
- long best=begin;
- ogg_page og;
-
- while(begin<end) {
- long bisect;
-
- if(end-begin < CHUNKSIZE)
- bisect=begin;
- else {
- /* Make an intelligent guess */
- bisect=begin+(target-begintime)*(end-begin)/
- (endtime-begintime) - CHUNKSIZE;
- if(bisect<=begin)
- bisect=begin+1;
- }
-
- again:
- _seek_helper(vf,bisect);
- ret=_get_next_page(vf,&og, end-bisect);
- if(ret == OV_FALSE || ret==OV_EOF)
- {
- if(bisect==begin+1)
- goto found;
- if(bisect==0)
- goto seek_error;
- bisect -= CHUNKSIZE;
- if(bisect<=begin)
- bisect=begin+1;
- goto again;
- }
- else if(ret==OV_EREAD) goto seek_error;
- else
- {
- ogg_int64_t granulepos=ogg_page_granulepos(&og);
- if(granulepos<target){
- best=ret; /* Raw offset of current page */
- begin=vf->offset; /* Raw offset of next packet */
- begintime=granulepos;
-
- /* Assume that if we're within half a second of
- * our target, it'll be faster to scan directly
- * forward. */
- if(target-begintime<vf->vi->rate/2) {
- bisect=begin+1;
- goto again;
- }
- }
- else {
- if(bisect<=begin+1)
- goto found;
- if(end==vf->offset){
- /* near the end, try just back from here */
- bisect-=CHUNKSIZE;
- goto again;
- }
- end=vf->offset;
- endtime=granulepos;
- }
- }
- }
-
- /* Found the relevent page. Seek to it */
-found:
- if(link != vf->current_link){
- if((ret=ov_raw_seek(vf,best)))goto seek_error;
- } else {
- if((ret=ov_raw_seek_fast(vf,best,begintime,link)))goto seek_error;
- }
- }
-
-
-
-
-#if 0
{
ogg_int64_t target=pos-total;
long end=vf->offsets[link+1];
@@ -1017,7 +913,6 @@
if((ret=ov_raw_seek(vf,best)))goto seek_error;
}
-#endif
/* verify result */
if(vf->pcm_offset>=pos || pos>ov_pcm_total(vf,-1)){
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list