"Fossies" - the Fresh Open Source Software Archive

Member "faac-1_30/libfaac/bitstream.h" (16 Oct 2019, 4248 Bytes) of package /linux/misc/faac-1_30.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "bitstream.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.28_vs_1.29.9.2.

    1 /**********************************************************************
    2 MPEG-4 Audio VM
    3 Bit stream module
    4 
    5 
    6 
    7 This software module was originally developed by
    8 
    9 Heiko Purnhagen (University of Hannover)
   10 
   11 and edited by
   12 
   13 in the course of development of the MPEG-2 NBC/MPEG-4 Audio standard
   14 ISO/IEC 13818-7, 14496-1,2 and 3. This software module is an
   15 implementation of a part of one or more MPEG-2 NBC/MPEG-4 Audio tools
   16 as specified by the MPEG-2 NBC/MPEG-4 Audio standard. ISO/IEC gives
   17 users of the MPEG-2 NBC/MPEG-4 Audio standards free license to this
   18 software module or modifications thereof for use in hardware or
   19 software products claiming conformance to the MPEG-2 NBC/ MPEG-4 Audio
   20 standards. Those intending to use this software module in hardware or
   21 software products are advised that this use may infringe existing
   22 patents. The original developer of this software module and his/her
   23 company, the subsequent editors and their companies, and ISO/IEC have
   24 no liability for use of this software module or modifications thereof
   25 in an implementation. Copyright is not released for non MPEG-2
   26 NBC/MPEG-4 Audio conforming products. The original developer retains
   27 full right to use the code for his/her own purpose, assign or donate
   28 the code to a third party and to inhibit third party from using the
   29 code for non MPEG-2 NBC/MPEG-4 Audio conforming products. This
   30 copyright notice must be included in all copies or derivative works.
   31 
   32 Copyright (c) 1996.
   33 **********************************************************************/
   34 
   35 #ifndef BITSTREAM_H
   36 #define BITSTREAM_H
   37 
   38 #ifdef __cplusplus
   39 extern "C" {
   40 #endif /* __cplusplus */
   41 
   42 #include "frame.h"
   43 #include "coder.h"
   44 #include "channels.h"
   45 
   46 /*
   47  * Raw bitstream constants
   48  */
   49 #define LEN_SE_ID 3
   50 #define LEN_TAG 4
   51 #define LEN_GLOB_GAIN 8
   52 #define LEN_COM_WIN 1
   53 #define LEN_ICS_RESERV 1
   54 #define LEN_WIN_SEQ 2
   55 #define LEN_WIN_SH 1
   56 #define LEN_MAX_SFBL 6
   57 #define LEN_MAX_SFBS 4
   58 #define LEN_CB 4
   59 #define LEN_SCL_PCM 8
   60 #define LEN_PRED_PRES 1
   61 #define LEN_PRED_RST 1
   62 #define LEN_PRED_RSTGRP 5
   63 #define LEN_PRED_ENAB 1
   64 #define LEN_MASK_PRES 2
   65 #define LEN_MASK 1
   66 #define LEN_PULSE_PRES 1
   67 
   68 #define LEN_TNS_PRES 1
   69 #define LEN_TNS_NFILTL 2
   70 #define LEN_TNS_NFILTS 1
   71 #define LEN_TNS_COEFF_RES 1
   72 #define LEN_TNS_LENGTHL 6
   73 #define LEN_TNS_LENGTHS 4
   74 #define LEN_TNS_ORDERL 5
   75 #define LEN_TNS_ORDERS 3
   76 #define LEN_TNS_DIRECTION 1
   77 #define LEN_TNS_COMPRESS 1
   78 #define LEN_GAIN_PRES 1
   79 
   80 #define LEN_NEC_NPULSE 2
   81 #define LEN_NEC_ST_SFB 6
   82 #define LEN_NEC_POFF 5
   83 #define LEN_NEC_PAMP 4
   84 #define NUM_NEC_LINES 4
   85 #define NEC_OFFSET_AMP 4
   86 
   87 #define LEN_NCC 3
   88 #define LEN_IS_CPE 1
   89 #define LEN_CC_LR 1
   90 #define LEN_CC_DOM 1
   91 #define LEN_CC_SGN 1
   92 #define LEN_CCH_GES 2
   93 #define LEN_CCH_CGP 1
   94 #define LEN_D_CNT 4
   95 #define LEN_D_ESC 12
   96 #define LEN_F_CNT 4
   97 #define LEN_F_ESC 8
   98 #define LEN_BYTE 8
   99 #define LEN_PAD_DATA 8
  100 
  101 #define LEN_PC_COMM 8
  102 
  103 #ifdef DRM
  104 # define LEN_HCR_REORDSD 14
  105 # define LEN_HCR_LONGCW 6
  106 # define FIRST_PAIR_HCB 5
  107 # define QUAD_LEN 4
  108 # define PAIR_LEN 2
  109 #endif
  110 
  111 #define ID_SCE 0
  112 #define ID_CPE 1
  113 #define ID_CCE 2
  114 #define ID_LFE 3
  115 #define ID_DSE 4
  116 #define ID_PCE 5
  117 #define ID_FIL 6
  118 #define ID_END 7
  119 
  120 
  121 /* MPEG ID's */
  122 #define MPEG2 1
  123 #define MPEG4 0
  124 
  125 /* AAC object types */
  126 #define MAIN 1
  127 #define LOW  2
  128 #define SSR  3
  129 #define LTP  4
  130 
  131 
  132 #define BYTE_NUMBIT 8       /* bits in byte (char) */
  133 #define LONG_NUMBIT 32      /* bits in unsigned long */
  134 #define bit2byte(a) (((a)+BYTE_NUMBIT-1)/BYTE_NUMBIT)
  135 
  136 enum {ADTS_FRAMESIZE = 1 << 13};
  137 
  138 typedef struct
  139 {
  140   unsigned char *data;      /* data bits */
  141   long numBit;          /* number of bits in buffer */
  142   long size;            /* buffer size in bytes */
  143   long currentBit;      /* current bit position in bit stream */
  144   long numByte;         /* number of bytes read/written (only file) */
  145 } BitStream;
  146 
  147 
  148 
  149 int WriteBitstream(faacEncStruct* hEncoder,
  150                    CoderInfo *coderInfo,
  151                    ChannelInfo *channelInfo,
  152                    BitStream *bitStream,
  153                    int numChannels);
  154 
  155 
  156 BitStream *OpenBitStream(int size, unsigned char *buffer);
  157 
  158 int CloseBitStream(BitStream *bitStream);
  159 
  160 int PutBit(BitStream *bitStream,
  161            unsigned long data,
  162            int numBit);
  163 
  164 #ifdef __cplusplus
  165 }
  166 #endif /* __cplusplus */
  167 
  168 #endif /* BITSTREAM_H */
  169