media/libvorbis/lib/codec_internal.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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 http://www.xiph.org/                  *
    10  *                                                                  *
    11  ********************************************************************
    13  function: libvorbis codec headers
    14  last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
    16  ********************************************************************/
    18 #ifndef _V_CODECI_H_
    19 #define _V_CODECI_H_
    21 #include "envelope.h"
    22 #include "codebook.h"
    24 #define BLOCKTYPE_IMPULSE    0
    25 #define BLOCKTYPE_PADDING    1
    26 #define BLOCKTYPE_TRANSITION 0
    27 #define BLOCKTYPE_LONG       1
    29 #define PACKETBLOBS 15
    31 typedef struct vorbis_block_internal{
    32   float  **pcmdelay;  /* this is a pointer into local storage */
    33   float  ampmax;
    34   int    blocktype;
    36   oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
    37                                               blob [PACKETBLOBS/2] points to
    38                                               the oggpack_buffer in the
    39                                               main vorbis_block */
    40 } vorbis_block_internal;
    42 typedef void vorbis_look_floor;
    43 typedef void vorbis_look_residue;
    44 typedef void vorbis_look_transform;
    46 /* mode ************************************************************/
    47 typedef struct {
    48   int blockflag;
    49   int windowtype;
    50   int transformtype;
    51   int mapping;
    52 } vorbis_info_mode;
    54 typedef void vorbis_info_floor;
    55 typedef void vorbis_info_residue;
    56 typedef void vorbis_info_mapping;
    58 #include "psy.h"
    59 #include "bitrate.h"
    61 typedef struct private_state {
    62   /* local lookup storage */
    63   envelope_lookup        *ve; /* envelope lookup */
    64   int                     window[2];
    65   vorbis_look_transform **transform[2];    /* block, type */
    66   drft_lookup             fft_look[2];
    68   int                     modebits;
    69   vorbis_look_floor     **flr;
    70   vorbis_look_residue   **residue;
    71   vorbis_look_psy        *psy;
    72   vorbis_look_psy_global *psy_g_look;
    74   /* local storage, only used on the encoding side.  This way the
    75      application does not need to worry about freeing some packets'
    76      memory and not others'; packet storage is always tracked.
    77      Cleared next call to a _dsp_ function */
    78   unsigned char *header;
    79   unsigned char *header1;
    80   unsigned char *header2;
    82   bitrate_manager_state bms;
    84   ogg_int64_t sample_count;
    85 } private_state;
    87 /* codec_setup_info contains all the setup information specific to the
    88    specific compression/decompression mode in progress (eg,
    89    psychoacoustic settings, channel setup, options, codebook
    90    etc).
    91 *********************************************************************/
    93 #include "highlevel.h"
    94 typedef struct codec_setup_info {
    96   /* Vorbis supports only short and long blocks, but allows the
    97      encoder to choose the sizes */
    99   long blocksizes[2];
   101   /* modes are the primary means of supporting on-the-fly different
   102      blocksizes, different channel mappings (LR or M/A),
   103      different residue backends, etc.  Each mode consists of a
   104      blocksize flag and a mapping (along with the mapping setup */
   106   int        modes;
   107   int        maps;
   108   int        floors;
   109   int        residues;
   110   int        books;
   111   int        psys;     /* encode only */
   113   vorbis_info_mode       *mode_param[64];
   114   int                     map_type[64];
   115   vorbis_info_mapping    *map_param[64];
   116   int                     floor_type[64];
   117   vorbis_info_floor      *floor_param[64];
   118   int                     residue_type[64];
   119   vorbis_info_residue    *residue_param[64];
   120   static_codebook        *book_param[256];
   121   codebook               *fullbooks;
   123   vorbis_info_psy        *psy_param[4]; /* encode only */
   124   vorbis_info_psy_global psy_g_param;
   126   bitrate_manager_info   bi;
   127   highlevel_encode_setup hi; /* used only by vorbisenc.c.  It's a
   128                                 highly redundant structure, but
   129                                 improves clarity of program flow. */
   130   int         halfrate_flag; /* painless downsample for decode */
   131 } codec_setup_info;
   133 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
   134 extern void _vp_global_free(vorbis_look_psy_global *look);
   138 typedef struct {
   139   int sorted_index[VIF_POSIT+2];
   140   int forward_index[VIF_POSIT+2];
   141   int reverse_index[VIF_POSIT+2];
   143   int hineighbor[VIF_POSIT];
   144   int loneighbor[VIF_POSIT];
   145   int posts;
   147   int n;
   148   int quant_q;
   149   vorbis_info_floor1 *vi;
   151   long phrasebits;
   152   long postbits;
   153   long frames;
   154 } vorbis_look_floor1;
   158 extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
   159                           const float *logmdct,   /* in */
   160                           const float *logmask);
   161 extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
   162                           int *A,int *B,
   163                           int del);
   164 extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
   165                   vorbis_look_floor1 *look,
   166                   int *post,int *ilogmask);
   167 #endif

mercurial