Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | RSS feed

  1. /********************************************************************
  2.  *                                                                  *
  3.  * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  4.  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
  5.  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  6.  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  7.  *                                                                  *
  8.  * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  9.  * by the Xiph.Org Foundation https://xiph.org/                     *
  10.  *                                                                  *
  11.  ********************************************************************
  12.  
  13.  function: libvorbis codec headers
  14.  
  15.  ********************************************************************/
  16.  
  17. #ifndef _V_CODECI_H_
  18. #define _V_CODECI_H_
  19.  
  20. #include "envelope.h"
  21. #include "codebook.h"
  22.  
  23. #define BLOCKTYPE_IMPULSE    0
  24. #define BLOCKTYPE_PADDING    1
  25. #define BLOCKTYPE_TRANSITION 0
  26. #define BLOCKTYPE_LONG       1
  27.  
  28. #define PACKETBLOBS 15
  29.  
  30. typedef struct vorbis_block_internal{
  31.   float  **pcmdelay;  /* this is a pointer into local storage */
  32.   float  ampmax;
  33.   int    blocktype;
  34.  
  35.   oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
  36.                                               blob [PACKETBLOBS/2] points to
  37.                                               the oggpack_buffer in the
  38.                                               main vorbis_block */
  39. } vorbis_block_internal;
  40.  
  41. typedef void vorbis_look_floor;
  42. typedef void vorbis_look_residue;
  43. typedef void vorbis_look_transform;
  44.  
  45. /* mode ************************************************************/
  46. typedef struct {
  47.   int blockflag;
  48.   int windowtype;
  49.   int transformtype;
  50.   int mapping;
  51. } vorbis_info_mode;
  52.  
  53. typedef void vorbis_info_floor;
  54. typedef void vorbis_info_residue;
  55. typedef void vorbis_info_mapping;
  56.  
  57. #include "psy.h"
  58. #include "bitrate.h"
  59.  
  60. typedef struct private_state {
  61.   /* local lookup storage */
  62.   envelope_lookup        *ve; /* envelope lookup */
  63.   int                     window[2];
  64.   vorbis_look_transform **transform[2];    /* block, type */
  65.   drft_lookup             fft_look[2];
  66.  
  67.   int                     modebits;
  68.   vorbis_look_floor     **flr;
  69.   vorbis_look_residue   **residue;
  70.   vorbis_look_psy        *psy;
  71.   vorbis_look_psy_global *psy_g_look;
  72.  
  73.   /* local storage, only used on the encoding side.  This way the
  74.      application does not need to worry about freeing some packets'
  75.      memory and not others'; packet storage is always tracked.
  76.      Cleared next call to a _dsp_ function */
  77.   unsigned char *header;
  78.   unsigned char *header1;
  79.   unsigned char *header2;
  80.  
  81.   bitrate_manager_state bms;
  82.  
  83.   ogg_int64_t sample_count;
  84. } private_state;
  85.  
  86. /* codec_setup_info contains all the setup information specific to the
  87.    specific compression/decompression mode in progress (eg,
  88.    psychoacoustic settings, channel setup, options, codebook
  89.    etc).
  90. *********************************************************************/
  91.  
  92. #include "highlevel.h"
  93. typedef struct codec_setup_info {
  94.  
  95.   /* Vorbis supports only short and long blocks, but allows the
  96.      encoder to choose the sizes */
  97.  
  98.   long blocksizes[2];
  99.  
  100.   /* modes are the primary means of supporting on-the-fly different
  101.      blocksizes, different channel mappings (LR or M/A),
  102.      different residue backends, etc.  Each mode consists of a
  103.      blocksize flag and a mapping (along with the mapping setup */
  104.  
  105.   int        modes;
  106.   int        maps;
  107.   int        floors;
  108.   int        residues;
  109.   int        books;
  110.   int        psys;     /* encode only */
  111.  
  112.   vorbis_info_mode       *mode_param[64];
  113.   int                     map_type[64];
  114.   vorbis_info_mapping    *map_param[64];
  115.   int                     floor_type[64];
  116.   vorbis_info_floor      *floor_param[64];
  117.   int                     residue_type[64];
  118.   vorbis_info_residue    *residue_param[64];
  119.   static_codebook        *book_param[256];
  120.   codebook               *fullbooks;
  121.  
  122.   vorbis_info_psy        *psy_param[4]; /* encode only */
  123.   vorbis_info_psy_global psy_g_param;
  124.  
  125.   bitrate_manager_info   bi;
  126.   highlevel_encode_setup hi; /* used only by vorbisenc.c.  It's a
  127.                                 highly redundant structure, but
  128.                                 improves clarity of program flow. */
  129.   int         halfrate_flag; /* painless downsample for decode */
  130. } codec_setup_info;
  131.  
  132. extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
  133. extern void _vp_global_free(vorbis_look_psy_global *look);
  134.  
  135.  
  136.  
  137. typedef struct {
  138.   int sorted_index[VIF_POSIT+2];
  139.   int forward_index[VIF_POSIT+2];
  140.   int reverse_index[VIF_POSIT+2];
  141.  
  142.   int hineighbor[VIF_POSIT];
  143.   int loneighbor[VIF_POSIT];
  144.   int posts;
  145.  
  146.   int n;
  147.   int quant_q;
  148.   vorbis_info_floor1 *vi;
  149.  
  150.   long phrasebits;
  151.   long postbits;
  152.   long frames;
  153. } vorbis_look_floor1;
  154.  
  155.  
  156.  
  157. extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
  158.                           const float *logmdct,   /* in */
  159.                           const float *logmask);
  160. extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
  161.                           int *A,int *B,
  162.                           int del);
  163. extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
  164.                   vorbis_look_floor1 *look,
  165.                   int *post,int *ilogmask);
  166. #endif
  167.