X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=lib%2Fcodec_internal.h;h=2dcfbc5dfe1cb9da1b5cd672ec508dfbbec9d892;hb=e5b1378996dba3ea82fb35403cb1f0bbff19495c;hp=826f533754921cf5d3a17c3cd2199e176aa4d2fd;hpb=aa7a3d9b4e84e85a18512c98aa14aeefb2f3e129;p=platform%2Fupstream%2Flibvorbis.git diff --git a/lib/codec_internal.h b/lib/codec_internal.h index 826f533..2dcfbc5 100644 --- a/lib/codec_internal.h +++ b/lib/codec_internal.h @@ -1,18 +1,17 @@ /******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * - * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY * - * THE GNU LESSER/LIBRARY PUBLIC LICENSE, WHICH IS INCLUDED WITH * - * THIS SOURCE. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * + * 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-2000 * - * by Monty and the XIPHOPHORUS Company * - * http://www.xiph.org/ * + * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009 * + * by the Xiph.Org Foundation http://www.xiph.org/ * * * ******************************************************************** function: libvorbis codec headers - last mod: $Id: codec_internal.h,v 1.4 2001/01/22 01:38:24 xiphmont Exp $ + last mod: $Id$ ********************************************************************/ @@ -21,30 +20,56 @@ #include "envelope.h" #include "codebook.h" -#include "psy.h" -#include "bitbuffer.h" + +#define BLOCKTYPE_IMPULSE 0 +#define BLOCKTYPE_PADDING 1 +#define BLOCKTYPE_TRANSITION 0 +#define BLOCKTYPE_LONG 1 + +#define PACKETBLOBS 15 typedef struct vorbis_block_internal{ - float **pcmdelay; /* this is a pointer into local storage */ + float **pcmdelay; /* this is a pointer into local storage */ float ampmax; + int blocktype; + + oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed; + blob [PACKETBLOBS/2] points to + the oggpack_buffer in the + main vorbis_block */ } vorbis_block_internal; -typedef void vorbis_look_time; -typedef void vorbis_look_mapping; typedef void vorbis_look_floor; typedef void vorbis_look_residue; typedef void vorbis_look_transform; -typedef struct backend_lookup_state { +/* mode ************************************************************/ +typedef struct { + int blockflag; + int windowtype; + int transformtype; + int mapping; +} vorbis_info_mode; + +typedef void vorbis_info_floor; +typedef void vorbis_info_residue; +typedef void vorbis_info_mapping; + +#include "psy.h" +#include "bitrate.h" + +typedef struct private_state { /* local lookup storage */ - envelope_lookup *ve; /* envelope lookup */ - float **window[2][2][2]; /* block, leadin, leadout, type */ + envelope_lookup *ve; /* envelope lookup */ + int window[2]; vorbis_look_transform **transform[2]; /* block, type */ - codebook *fullbooks; + drft_lookup fft_look[2]; - /* backend lookups are tied to the mode, not the backend or naked mapping */ int modebits; - vorbis_look_mapping **mode; + vorbis_look_floor **flr; + vorbis_look_residue **residue; + vorbis_look_psy *psy; + vorbis_look_psy_global *psy_g_look; /* local storage, only used on the encoding side. This way the application does not need to worry about freeing some packets' @@ -54,29 +79,18 @@ typedef struct backend_lookup_state { unsigned char *header1; unsigned char *header2; - float ampmax; + bitrate_manager_state bms; -} backend_lookup_state; + ogg_int64_t sample_count; +} private_state; -/* mode ************************************************************/ -typedef struct { - int blockflag; - int windowtype; - int transformtype; - int mapping; -} vorbis_info_mode; - -typedef void vorbis_info_time; -typedef void vorbis_info_floor; -typedef void vorbis_info_residue; -typedef void vorbis_info_mapping; - -/* vorbis_info contains all the setup information specific to the +/* codec_setup_info contains all the setup information specific to the specific compression/decompression mode in progress (eg, psychoacoustic settings, channel setup, options, codebook - etc). + etc). *********************************************************************/ +#include "highlevel.h" typedef struct codec_setup_info { /* Vorbis supports only short and long blocks, but allows the @@ -85,42 +99,69 @@ typedef struct codec_setup_info { long blocksizes[2]; /* modes are the primary means of supporting on-the-fly different - blocksizes, different channel mappings (LR or mid-side), + blocksizes, different channel mappings (LR or M/A), different residue backends, etc. Each mode consists of a blocksize flag and a mapping (along with the mapping setup */ int modes; int maps; - int times; int floors; int residues; int books; int psys; /* encode only */ - vorbis_info_mode *mode_param[64]; - int map_type[64]; - vorbis_info_mapping *map_param[64]; - int time_type[64]; - vorbis_info_time *time_param[64]; - int floor_type[64]; - vorbis_info_floor *floor_param[64]; - int residue_type[64]; - vorbis_info_residue *residue_param[64]; - static_codebook *book_param[256]; - vorbis_info_psy *psy_param[64]; /* encode only */ - - /* for block long/sort tuning; encode only */ - int envelopesa; - float preecho_thresh; - float postecho_thresh; - float preecho_minenergy; - - float ampmax_att_per_sec; - - /* delay caching... how many samples to keep around prior to our - current block to aid in analysis? */ - int delaycache; + vorbis_info_mode *mode_param[64]; + int map_type[64]; + vorbis_info_mapping *map_param[64]; + int floor_type[64]; + vorbis_info_floor *floor_param[64]; + int residue_type[64]; + vorbis_info_residue *residue_param[64]; + static_codebook *book_param[256]; + codebook *fullbooks; + + vorbis_info_psy *psy_param[4]; /* encode only */ + vorbis_info_psy_global psy_g_param; + bitrate_manager_info bi; + highlevel_encode_setup hi; /* used only by vorbisenc.c. It's a + highly redundant structure, but + improves clarity of program flow. */ + int halfrate_flag; /* painless downsample for decode */ } codec_setup_info; +extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi); +extern void _vp_global_free(vorbis_look_psy_global *look); + + + +typedef struct { + int sorted_index[VIF_POSIT+2]; + int forward_index[VIF_POSIT+2]; + int reverse_index[VIF_POSIT+2]; + + int hineighbor[VIF_POSIT]; + int loneighbor[VIF_POSIT]; + int posts; + + int n; + int quant_q; + vorbis_info_floor1 *vi; + + long phrasebits; + long postbits; + long frames; +} vorbis_look_floor1; + + + +extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look, + const float *logmdct, /* in */ + const float *logmask); +extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look, + int *A,int *B, + int del); +extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb, + vorbis_look_floor1 *look, + int *post,int *ilogmask); #endif