diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-28 13:23:19 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2010-04-28 13:23:19 +0400 |
commit | aa39873281217e6ed92899bc3f2ade5146e5ae38 (patch) | |
tree | 71e113155a50c19aa9412666ed8fa276227a85ef | |
parent | 5f5d87ef81a2933b3c7047c997a824e1bb693d4c (diff) |
added missing libvorbis file
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1817 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r-- | include/ogg/ogg.h | 3 | ||||
-rw-r--r-- | src/filters/transform/MpaDecFilter/libvorbisidec/analysis.c | 120 |
2 files changed, 121 insertions, 2 deletions
diff --git a/include/ogg/ogg.h b/include/ogg/ogg.h index 17ea82e2c..ae0cfd534 100644 --- a/include/ogg/ogg.h +++ b/include/ogg/ogg.h @@ -11,7 +11,7 @@ ******************************************************************** function: toplevel libogg include - last mod: $Id: ogg.h 17098 2010-03-29 05:35:11Z gmaxwell $ + last mod: $Id: ogg.h 16051 2009-05-27 05:00:06Z xiphmont $ ********************************************************************/ #ifndef _OGG_H @@ -159,7 +159,6 @@ extern int ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op); extern int ogg_stream_iovecin(ogg_stream_state *os, ogg_iovec_t *iov, int count, long e_o_s, ogg_int64_t granulepos); extern int ogg_stream_pageout(ogg_stream_state *os, ogg_page *og); -extern int ogg_stream_pageout_fill(ogg_stream_state *os, ogg_page *og, int nfill); extern int ogg_stream_flush(ogg_stream_state *os, ogg_page *og); /* Ogg BITSTREAM PRIMITIVES: decoding **************************/ diff --git a/src/filters/transform/MpaDecFilter/libvorbisidec/analysis.c b/src/filters/transform/MpaDecFilter/libvorbisidec/analysis.c new file mode 100644 index 000000000..01aa6f30d --- /dev/null +++ b/src/filters/transform/MpaDecFilter/libvorbisidec/analysis.c @@ -0,0 +1,120 @@ +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * + * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * + * 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-2007 * + * by the Xiph.Org Foundation http://www.xiph.org/ * + * * + ******************************************************************** + + function: single-block PCM analysis mode dispatch + last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $ + + ********************************************************************/ + +#include <stdio.h> +#include <string.h> +#include <math.h> +#include <ogg/ogg.h> +#include "vorbis/codec.h" +#include "codec_internal.h" +#include "registry.h" +#include "scales.h" +#include "os.h" +#include "misc.h" + +/* decides between modes, dispatches to the appropriate mapping. */ +int vorbis_analysis(vorbis_block *vb, ogg_packet *op){ + int ret,i; + vorbis_block_internal *vbi=vb->internal; + + vb->glue_bits=0; + vb->time_bits=0; + vb->floor_bits=0; + vb->res_bits=0; + + /* first things first. Make sure encode is ready */ + for(i=0;i<PACKETBLOBS;i++) + oggpack_reset(vbi->packetblob[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[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; + op->e_o_s=vb->eofflag; + op->granulepos=vb->granulepos; + op->packetno=vb->sequence; /* for sake of completeness */ + } + 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,ogg_int64_t off){ + int j; + FILE *of; + char buffer[80]; + + sprintf(buffer,"%s_%d.m",base,i); + of=fopen(buffer,"w"); + + if(!of)perror("failed to open data dump file"); + + for(j=0;j<n;j++){ + if(bark){ + float b=toBARK((4000.f*j/n)+.25); + fprintf(of,"%f ",b); + }else + if(off!=0) + fprintf(of,"%f ",(double)(j+off)/8000.); + else + fprintf(of,"%f ",(double)j); + + if(dB){ + float val; + if(v[j]==0.) + val=-140.; + else + val=todB(v+j); + fprintf(of,"%f\n",val); + }else{ + fprintf(of,"%f\n",v[j]); + } + } + fclose(of); +} + +void _analysis_output(char *base,int i,float *v,int n,int bark,int dB, + ogg_int64_t off){ + if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off); +} + +#endif + + + + + + + + + + + |