X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fanalysis.c;h=9609cd5c282fecb2afc7279d3aaf60a0fc5eb5cb;hb=321cfc8e0ed3fddba45ec8a68f053d7e22fb9fd2;hp=518399fcb1bf5f3fc43f1c95ebeb4f70c8540ee8;hpb=8bc503a5542c92625e705000f381995a55af1b88;p=platform%2Fupstream%2Flibvorbis.git diff --git a/lib/analysis.c b/lib/analysis.c index 518399f..9609cd5 100644 --- a/lib/analysis.c +++ b/lib/analysis.c @@ -5,13 +5,13 @@ * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * * * - * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 * - * by the XIPHOPHORUS Company http://www.xiph.org/ * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007 * + * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c,v 1.48 2002/01/22 08:06:06 xiphmont Exp $ + last mod: $Id$ ********************************************************************/ @@ -26,16 +26,10 @@ #include "os.h" #include "misc.h" -int analysis_noisy=1; - /* decides between modes, dispatches to the appropriate mapping. */ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ - vorbis_dsp_state *vd=vb->vd; - backend_lookup_state *b=vd->backend_state; - vorbis_info *vi=vd->vi; - codec_setup_info *ci=vi->codec_setup; - int type,ret; - int mode=0; + int ret,i; + vorbis_block_internal *vbi=vb->internal; vb->glue_bits=0; vb->time_bits=0; @@ -43,30 +37,22 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ vb->res_bits=0; /* first things first. Make sure encode is ready */ - oggpack_reset(&vb->opb); - /* Encode the packet type */ - oggpack_write(&vb->opb,0,1); - - /* currently lazy. Short block dispatches to 0, long to 1. */ - - if(vb->W &&ci->modes>1)mode=1; - type=ci->map_type[ci->mode_param[mode]->mapping]; - vb->mode=mode; - - /* Encode frame mode, pre,post windowsize, then dispatch */ - oggpack_write(&vb->opb,mode,b->modebits); - if(vb->W){ - oggpack_write(&vb->opb,vb->lW,1); - oggpack_write(&vb->opb,vb->nW,1); - /*fprintf(stderr,"*"); - }else{ - fprintf(stderr,".");*/ - } + for(i=0;ipacketblob[i]); + + /* we only have one mapping type (0), and we let the mapping code + itself figure out what soft mode to use. This allows easier + bitrate management */ - if((ret=_mapping_P[type]->forward(vb,b->mode[mode]))) + if((ret=_mapping_P[0]->forward(vb))) return(ret); if(op){ + if(vorbis_bitrate_managed(vb)) + /* The app is using a bitmanaged mode... but not using the + bitrate management interface. */ + return(OV_EINVAL); + op->packet=oggpack_get_buffer(&vb->opb); op->bytes=oggpack_bytes(&vb->opb); op->b_o_s=0; @@ -77,41 +63,58 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ return(0); } +#ifdef ANALYSIS +int analysis_noisy=1; + /* there was no great place to put this.... */ -void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB){ +void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){ int j; FILE *of; char buffer[80]; - /* if(i==5870){*/ - sprintf(buffer,"%s_%d.m",base,i); - of=fopen(buffer,"w"); - - if(!of)perror("failed to open data dump file"); - - for(j=0;j