Merging the postbeta2 branch onto the mainline.
[platform/upstream/libvorbis.git] / include / vorbis / codec.h
index 38e24fc..221c5d6 100644 (file)
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.29 2000/08/30 07:09:46 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.30 2000/10/12 03:12:41 xiphmont Exp $
 
  ********************************************************************/
 
@@ -26,9 +26,8 @@ extern "C"
 
 #define MAX_BARK 27
 
-#include "os_types.h"
+#include <ogg/ogg.h>
 #include "vorbis/codebook.h"
-#include "vorbis/internal.h"
 
 typedef void vorbis_look_transform;
 typedef void vorbis_info_time;
@@ -58,29 +57,29 @@ typedef struct vorbis_info_psy{
   int    smoothp;
 
   int    noisecullp;
-  double noisecull_barkwidth;
+  float noisecull_barkwidth;
 
-  double ath_adjatt;
-  double ath_maxatt;
+  float ath_adjatt;
+  float ath_maxatt;
 
   /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
   /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
   /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
 
   int tonemaskp;
-  double toneatt[P_BANDS][P_LEVELS];
+  float toneatt[P_BANDS][P_LEVELS];
 
   int peakattp;
-  double peakatt[P_BANDS][P_LEVELS];
+  float peakatt[P_BANDS][P_LEVELS];
 
   int noisemaskp;
-  double noiseatt[P_BANDS][P_LEVELS];
+  float noiseatt[P_BANDS][P_LEVELS];
 
-  double max_curve_dB;
+  float max_curve_dB;
 
   /* decay setup */
-  double attack_coeff;
-  double decay_coeff;
+  float attack_coeff;
+  float decay_coeff;
 } vorbis_info_psy;
 
 /* vorbis_info contains all the setup information specific to the
@@ -145,86 +144,11 @@ typedef struct vorbis_info{
   
   /* for block long/sort tuning; encode only */
   int        envelopesa;
-  double     preecho_thresh;
-  double     preecho_clamp;
-  double     preecho_minenergy;
+  float     preecho_thresh;
+  float     preecho_clamp;
+  float     preecho_minenergy;
 } vorbis_info;
  
-/* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/
-
-typedef struct {
-  unsigned char *header;
-  long header_len;
-  unsigned char *body;
-  long body_len;
-} ogg_page;
-
-/* ogg_stream_state contains the current encode/decode state of a logical
-   Ogg bitstream **********************************************************/
-
-typedef struct {
-  unsigned char   *body_data;    /* bytes from packet bodies */
-  long    body_storage;          /* storage elements allocated */
-  long    body_fill;             /* elements stored; fill mark */
-  long    body_returned;         /* elements of fill returned */
-
-
-  int     *lacing_vals;    /* The values that will go to the segment table */
-  ogg_int64_t *pcm_vals;      /* pcm_pos values for headers. Not compact
-                            this way, but it is simple coupled to the
-                            lacing fifo */
-  long    lacing_storage;
-  long    lacing_fill;
-  long    lacing_packet;
-  long    lacing_returned;
-
-  unsigned char    header[282];      /* working space for header encode */
-  int              header_fill;
-
-  int     e_o_s;          /* set when we have buffered the last packet in the
-                            logical bitstream */
-  int     b_o_s;          /* set after we've written the initial page
-                            of a logical bitstream */
-  long     serialno;
-  int      pageno;
-  ogg_int64_t  packetno;      /* sequence number for decode; the framing
-                             knows where there's a hole in the data,
-                             but we need coupling so that the codec
-                             (which is in a seperate abstraction
-                             layer) also knows about the gap */
-  ogg_int64_t   pcmpos;
-
-} ogg_stream_state;
-
-/* ogg_packet is used to encapsulate the data and metadata belonging
-   to a single raw Ogg/Vorbis packet *************************************/
-
-typedef struct {
-  unsigned char *packet;
-  long  bytes;
-  long  b_o_s;
-  long  e_o_s;
-
-  ogg_int64_t  frameno;
-  ogg_int64_t  packetno;       /* sequence number for decode; the framing
-                             knows where there's a hole in the data,
-                             but we need coupling so that the codec
-                             (which is in a seperate abstraction
-                             layer) also knows about the gap */
-
-} ogg_packet;
-
-typedef struct {
-  unsigned char *data;
-  int storage;
-  int fill;
-  int returned;
-
-  int unsynced;
-  int headerbytes;
-  int bodybytes;
-} ogg_sync_state;
-
 /* vorbis_dsp_state buffers the current vorbis audio
    analysis/synthesis state.  The DSP state belongs to a specific
    logical bitstream ****************************************************/
@@ -233,8 +157,8 @@ typedef struct vorbis_dsp_state{
   vorbis_info *vi;
   int    modebits;
 
-  double **pcm;
-  double **pcmret;
+  float **pcm;
+  float **pcmret;
   int      pcm_storage;
   int      pcm_current;
   int      pcm_returned;
@@ -247,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;
@@ -257,7 +181,7 @@ typedef struct vorbis_dsp_state{
 
   /* local lookup storage */
   void                   *ve; /* envelope lookup */    
-  double                **window[2][2][2]; /* block, leadin, leadout, type */
+  float                **window[2][2][2]; /* block, leadin, leadout, type */
   vorbis_look_transform **transform[2];    /* block, type */
   codebook               *fullbooks;
   /* backend lookups are tied to the mode, not the backend or naked mapping */
@@ -285,7 +209,7 @@ struct alloc_chain{
 
 typedef struct vorbis_block{
   /* necessary stream state for linking to the framing abstraction */
-  double  **pcm;       /* this is a pointer into local storage */ 
+  float  **pcm;       /* this is a pointer into local storage */ 
   oggpack_buffer opb;
   
   long  lW;
@@ -295,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 */
 
@@ -348,42 +272,6 @@ typedef struct vorbis_comment{
    packetization aren't necessary as they're provided by the transport
    and the streaming layer is not used */
 
-/* OggSquish BITSREAM PRIMITIVES: encoding **************************/
-
-extern int      ogg_stream_packetin(ogg_stream_state *os, ogg_packet *op);
-extern int      ogg_stream_pageout(ogg_stream_state *os, ogg_page *og);
-extern int      ogg_stream_flush(ogg_stream_state *os, ogg_page *og);
-
-/* OggSquish BITSREAM PRIMITIVES: decoding **************************/
-
-extern int      ogg_sync_init(ogg_sync_state *oy);
-extern int      ogg_sync_clear(ogg_sync_state *oy);
-extern int      ogg_sync_destroy(ogg_sync_state *oy);
-extern int      ogg_sync_reset(ogg_sync_state *oy);
-
-extern char    *ogg_sync_buffer(ogg_sync_state *oy, long size);
-extern int      ogg_sync_wrote(ogg_sync_state *oy, long bytes);
-extern long     ogg_sync_pageseek(ogg_sync_state *oy,ogg_page *og);
-extern int      ogg_sync_pageout(ogg_sync_state *oy, ogg_page *og);
-extern int      ogg_stream_pagein(ogg_stream_state *os, ogg_page *og);
-extern int      ogg_stream_packetout(ogg_stream_state *os,ogg_packet *op);
-
-/* OggSquish BITSREAM PRIMITIVES: general ***************************/
-
-extern int      ogg_stream_init(ogg_stream_state *os,int serialno);
-extern int      ogg_stream_clear(ogg_stream_state *os);
-extern int      ogg_stream_reset(ogg_stream_state *os);
-extern int      ogg_stream_destroy(ogg_stream_state *os);
-extern int      ogg_stream_eof(ogg_stream_state *os);
-
-extern int      ogg_page_version(ogg_page *og);
-extern int      ogg_page_continued(ogg_page *og);
-extern int      ogg_page_bos(ogg_page *og);
-extern int      ogg_page_eos(ogg_page *og);
-extern ogg_int64_t  ogg_page_frameno(ogg_page *og);
-extern int      ogg_page_serialno(ogg_page *og);
-extern int      ogg_page_pageno(ogg_page *og);
-
 /* Vorbis PRIMITIVES: general ***************************************/
 
 extern void     vorbis_info_init(vorbis_info *vi);
@@ -408,7 +296,7 @@ extern int      vorbis_analysis_headerout(vorbis_dsp_state *v,
                                          ogg_packet *op,
                                          ogg_packet *op_comm,
                                          ogg_packet *op_code);
-extern double **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
+extern float  **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
 extern int      vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
 extern int      vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
 extern int      vorbis_analysis(vorbis_block *vb,ogg_packet *op);
@@ -420,7 +308,7 @@ extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
 extern int      vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
 extern int      vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
 extern int      vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
-extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,double ***pcm);
+extern int      vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm);
 extern int      vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
 
 #ifdef __cplusplus