Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 /*
     19 ------------------------------------------------------------------------------
     20    PacketVideo Corp.
     21    MP3 Decoder Library
     22 
     23    Filename: pvmp3_dec_defs.h
     24 
     25      Date: 09/21/2007
     26 
     27 ------------------------------------------------------------------------------
     28  REVISION HISTORY
     29 
     30  Description:
     31 
     32 ------------------------------------------------------------------------------
     33  INCLUDE DESCRIPTION
     34 
     35  This include file has the mp3 decoder common defines.
     36 
     37 ------------------------------------------------------------------------------
     38 */
     39 
     40 /*----------------------------------------------------------------------------
     41 ; CONTINUE ONLY IF NOT ALREADY DEFINED
     42 ----------------------------------------------------------------------------*/
     43 #ifndef PVMP3_DEC_DEFS_H
     44 #define PVMP3_DEC_DEFS_H
     45 
     46 /*----------------------------------------------------------------------------
     47 ; INCLUDES
     48 ----------------------------------------------------------------------------*/
     49 #include "pvmp3_audio_type_defs.h"
     50 #include "pvmp3decoder_api.h"
     51 
     52 /*----------------------------------------------------------------------------
     53 ; MACROS
     54 ; Define module specific macros here
     55 ----------------------------------------------------------------------------*/
     56 #define module(x, POW2)   ((x)&((POW2)-1))
     57 
     58 /*----------------------------------------------------------------------------
     59 ; DEFINES
     60 ; Include all pre-processor statements here.
     61 ----------------------------------------------------------------------------*/
     62 #define BUFSIZE   8192   // big enough to hold 4608 bytes == biggest mp3 frame
     63 
     64 #define CHAN           2
     65 #define GRAN           2
     66 
     67 
     68 #define SUBBANDS_NUMBER        32
     69 #define FILTERBANK_BANDS       18
     70 #define HAN_SIZE              512
     71 
     72 
     73 /* MPEG Header Definitions - ID Bit Values */
     74 
     75 #define MPEG_1              0
     76 #define MPEG_2              1
     77 #define MPEG_2_5            2
     78 #define INVALID_VERSION   (-1)
     79 
     80 /* MPEG Header Definitions - Mode Values */
     81 
     82 #define MPG_MD_STEREO           0
     83 #define MPG_MD_JOINT_STEREO     1
     84 #define MPG_MD_DUAL_CHANNEL     2
     85 #define MPG_MD_MONO             3
     86 
     87 
     88 
     89 #define LEFT        0
     90 #define RIGHT       1
     91 
     92 
     93 #define SYNC_WORD         (int32)0x7ff
     94 #define SYNC_WORD_LNGTH   11
     95 
     96 /*----------------------------------------------------------------------------
     97 ; EXTERNAL VARIABLES REFERENCES
     98 ; Declare variables used in this module but defined elsewhere
     99 ----------------------------------------------------------------------------*/
    100 
    101 /*----------------------------------------------------------------------------
    102 ; SIMPLE TYPEDEF'S
    103 ----------------------------------------------------------------------------*/
    104 
    105 /*----------------------------------------------------------------------------
    106 ; ENUMERATED TYPEDEF'S
    107 ----------------------------------------------------------------------------*/
    108 #ifdef __cplusplus
    109 extern "C"
    110 {
    111 #endif
    112 
    113     /*----------------------------------------------------------------------------
    114     ; STRUCTURES TYPEDEF'S
    115     ----------------------------------------------------------------------------*/
    116 
    117     /* Header Information Structure */
    118 
    119     typedef struct
    120     {
    121         int32 version_x;
    122         int32 layer_description;
    123         int32 error_protection;
    124         int32 bitrate_index;
    125         int32 sampling_frequency;
    126         int32 padding;
    127         int32 extension;
    128         int32 mode;
    129         int32 mode_ext;
    130         int32 copyright;
    131         int32 original;
    132         int32 emphasis;
    133     } mp3Header;
    134 
    135 
    136     /* Layer III side information. */
    137 
    138     typedef  struct
    139     {
    140         uint32 part2_3_length;
    141         uint32 big_values;
    142         int32 global_gain;
    143         uint32 scalefac_compress;
    144         uint32 window_switching_flag;
    145         uint32 block_type;
    146         uint32 mixed_block_flag;
    147         uint32 table_select[3];
    148         uint32 subblock_gain[3];
    149         uint32 region0_count;
    150         uint32 region1_count;
    151         uint32 preflag;
    152         uint32 scalefac_scale;
    153         uint32 count1table_select;
    154 
    155     } granuleInfo;
    156 
    157     typedef  struct
    158     {
    159         uint32      scfsi[4];
    160         granuleInfo gran[2];
    161 
    162     } channelInfo;
    163 
    164     /* Layer III side info. */
    165 
    166     typedef struct
    167     {
    168         uint32      main_data_begin;
    169         uint32      private_bits;
    170         channelInfo ch[2];
    171 
    172     } mp3SideInfo;
    173 
    174     /* Layer III scale factors. */
    175     typedef struct
    176     {
    177         int32 l[23];            /* [cb] */
    178         int32 s[3][13];         /* [window][cb] */
    179 
    180     } mp3ScaleFactors;
    181 
    182 
    183 #ifdef __cplusplus
    184 }
    185 #endif
    186 
    187 /*----------------------------------------------------------------------------
    188 ; GLOBAL FUNCTION DEFINITIONS
    189 ; Function Prototype declaration
    190 ----------------------------------------------------------------------------*/
    191 
    192 /*----------------------------------------------------------------------------
    193 ; END
    194 ----------------------------------------------------------------------------*/
    195 
    196 #endif
    197 
    198 
    199 
    200