Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mpeg3audio.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef MPEG3AUDIO_H
00021 #define MPEG3AUDIO_H
00022 
00023 #include "ac3.h"
00024 #include "../bitstream.h"
00025 typedef struct mpeg3_atrack_rec mpeg3_atrack_t;
00026 
00027 #define MAXFRAMESIZE 1792
00028 #define HDRCMPMASK 0xfffffd00
00029 #define SBLIMIT 32
00030 #define SSLIMIT 18
00031 #define SCALE_BLOCK 12
00032 #define MPEG3AUDIO_PADDING 1024
00033 
00034 /* Values for mode */
00035 #define MPG_MD_STEREO                   0
00036 #define MPG_MD_JOINT_STEREO     1
00037 #define MPG_MD_DUAL_CHANNEL     2
00038 #define MPG_MD_MONO                     3
00039 
00040 /* IMDCT variables */
00041 typedef struct
00042 {
00043         mpeg3_real_t real;
00044         mpeg3_real_t imag;
00045 } mpeg3_complex_t;
00046 
00047 #define AC3_N 512
00048 
00049 struct al_table 
00050 {
00051         short bits;
00052         short d;
00053 };
00054 
00055 typedef struct
00056 {
00057         struct mpeg3_rec* file;
00058         mpeg3_atrack_t* track;
00059         mpeg3_bits_t *astream;
00060 
00061 /* In order of importance */
00062         int format;               /* format of audio */
00063         int layer;                /* layer if mpeg */
00064         int channels;
00065         long outscale;
00066         long framenum;
00067         long prev_framesize;
00068         long framesize;           /* For mp3 current framesize without header.  For AC3 current framesize with header. */
00069         int avg_framesize;      /* Includes the 4 byte header */
00070         mpeg3_real_t *pcm_sample;        /* Interlaced output from synthesizer in floats */
00071         int pcm_point;            /* Float offset in pcm_sample to write to */
00072         long pcm_position;        /* Sample start of pcm_samples in file */
00073         long pcm_size;            /* Number of pcm samples in the buffer */
00074         long pcm_allocated;       /* Allocated number of samples in pcm_samples */
00075         int sample_seek;
00076         double percentage_seek;
00077         unsigned long oldhead;
00078         unsigned long newhead;
00079         unsigned long firsthead;
00080         int bsnum;
00081         int lsf;
00082         int mpeg35;
00083         int sampling_frequency_code;
00084         int bitrate_index;
00085         int bitrate;
00086         int samples_per_frame;
00087         int padding;
00088         int extension;
00089         int mode;
00090         int mode_ext;
00091         int copyright;
00092         int original;
00093         int emphasis;
00094         int error_protection;
00095 
00096 /* Back step buffers for mp3 */
00097         unsigned char bsspace[2][MAXFRAMESIZE + 512]; /* MAXFRAMESIZE */
00098         unsigned char *bsbuf, *bsbufold;
00099         long ssize;
00100         int init;
00101         int single;
00102     struct al_table *alloc;
00103     int II_sblimit;
00104     int jsbound;
00105         int bo;                      /* Static variable in synthesizer */
00106 
00107 /* MP3 Static arrays here */
00108         mpeg3_real_t synth_stereo_buffs[2][2][0x110];
00109         mpeg3_real_t synth_mono_buff[64];
00110         unsigned int layer2_scfsi_buf[64];
00111 
00112         mpeg3_real_t mp3_block[2][2][SBLIMIT * SSLIMIT];
00113         int mp3_blc[2];
00114 
00115 /* AC3 specific stuff.  AC3 also shares objects with MPEG */
00116         unsigned int ac3_framesize_code;
00117         mpeg3_ac3bsi_t ac3_bsi;
00118         mpeg3_ac3audblk_t ac3_audblk;
00119         mpeg3_ac3_bitallocation_t ac3_bit_allocation;
00120         mpeg3_ac3_mantissa_t ac3_mantissa;
00121         mpeg3_complex_t ac3_imdct_buf[AC3_N / 4];
00122 
00123 /* Delay buffer for DCT interleaving */
00124         mpeg3_real_t ac3_delay[6][AC3_N / 2];
00125 /* Twiddle factor LUT */
00126         mpeg3_complex_t *ac3_w[7];
00127 #if !defined(USE_FIXED_POINT) || defined(PRINT_FIXED_POINT_TABLES)
00128         /* Just for allocated memory */
00129         mpeg3_complex_t ac3_w_1[1];
00130         mpeg3_complex_t ac3_w_2[2];
00131         mpeg3_complex_t ac3_w_4[4];
00132         mpeg3_complex_t ac3_w_8[8];
00133         mpeg3_complex_t ac3_w_16[16];
00134         mpeg3_complex_t ac3_w_32[32];
00135         mpeg3_complex_t ac3_w_64[64];
00136 #endif
00137         int ac3_lfsr_state;
00138         unsigned char ac3_buffer[MAX_AC3_FRAMESIZE];
00139         mpeg3ac3_stream_samples_t ac3_samples;
00140 } mpeg3audio_t;
00141 
00142 
00143 
00144 #endif

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2