[cvs] / xvidcore / src / bitstream / bitstream.h Repository:
ViewVC logotype

Diff of /xvidcore/src/bitstream/bitstream.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17.2.3, Fri Apr 4 22:13:35 2003 UTC revision 1.26, Tue Dec 28 19:19:43 2010 UTC
# Line 3  Line 3 
3   *  XVID MPEG-4 VIDEO CODEC   *  XVID MPEG-4 VIDEO CODEC
4   *  - Bitstream reader/writer inlined functions and constants-   *  - Bitstream reader/writer inlined functions and constants-
5   *   *
6   *  Copyright (C) 2001-2003 - Peter Ross <pross@xvid.org>   *  Copyright (C) 2001-2003 Peter Ross <pross@xvid.org>
7   *   *
8   *  This file is part of XviD, a free MPEG-4 video encoder/decoder   *  This program is free software ; you can redistribute it and/or modify
9   *   *  it under the terms of the GNU General Public License as published by
  *  XviD is free software; you can redistribute it and/or modify it  
  *  under the terms of the GNU General Public License as published by  
10   *  the Free Software Foundation; either version 2 of the License, or   *  the Free Software Foundation; either version 2 of the License, or
11   *  (at your option) any later version.   *  (at your option) any later version.
12   *   *
# Line 60  Line 58 
58    
59  #define VIDOBJLAY_TYPE_SIMPLE                   1  #define VIDOBJLAY_TYPE_SIMPLE                   1
60  /*#define VIDOBJLAY_TYPE_SIMPLE_SCALABLE    2 */  /*#define VIDOBJLAY_TYPE_SIMPLE_SCALABLE    2 */
61  #define VIDOBJLAY_TYPE_CORE                             3  /*#define VIDOBJLAY_TYPE_CORE                           3 */
62  #define VIDOBJLAY_TYPE_MAIN                             4  /*#define VIDOBJLAY_TYPE_MAIN                           4 */
63  /*#define VIDOBJLAY_TYPE_NBIT                           5 */  /*#define VIDOBJLAY_TYPE_NBIT                           5 */
64  /*#define VIDOBJLAY_TYPE_ANIM_TEXT                      6 */  /*#define VIDOBJLAY_TYPE_ANIM_TEXT                      6 */
65  /*#define VIDOBJLAY_TYPE_ANIM_MESH                      7 */  /*#define VIDOBJLAY_TYPE_ANIM_MESH                      7 */
# Line 69  Line 67 
67  /*#define VIDOBJLAY_TYPE_STILL_SCALABLE         9 */  /*#define VIDOBJLAY_TYPE_STILL_SCALABLE         9 */
68  #define VIDOBJLAY_TYPE_ART_SIMPLE               10  #define VIDOBJLAY_TYPE_ART_SIMPLE               10
69  /*#define VIDOBJLAY_TYPE_CORE_SCALABLE          11 */  /*#define VIDOBJLAY_TYPE_CORE_SCALABLE          11 */
70  #define VIDOBJLAY_TYPE_ACE                              12  /*#define VIDOBJLAY_TYPE_ACE                            12 */
71  /*#define VIDOBJLAY_TYPE_SIMPLE_FBA                     13 */  /*#define VIDOBJLAY_TYPE_ADVANCED_SCALABLE_TEXTURE 13 */
72    /*#define VIDOBJLAY_TYPE_SIMPLE_FBA                     14 */
73    /*#define VIDEOJLAY_TYPE_SIMPLE_STUDIO    15*/
74    /*#define VIDEOJLAY_TYPE_CORE_STUDIO      16*/
75  #define VIDOBJLAY_TYPE_ASP              17  #define VIDOBJLAY_TYPE_ASP              17
76    /*#define VIDOBJLAY_TYPE_FGS              18*/
77    
78    
79  /*#define VIDOBJLAY_AR_SQUARE           1 */  /*#define VIDOBJLAY_AR_SQUARE           1 */
# Line 126  Line 128 
128  int BitstreamReadHeaders(Bitstream * bs,  int BitstreamReadHeaders(Bitstream * bs,
129                                                   DECODER * dec,                                                   DECODER * dec,
130                                                   uint32_t * rounding,                                                   uint32_t * rounding,
                                                  uint32_t * reduced_resolution,  
131                                                   uint32_t * quant,                                                   uint32_t * quant,
132                                                   uint32_t * fcode_forward,                                                   uint32_t * fcode_forward,
133                                                   uint32_t * fcode_backward,                                                   uint32_t * fcode_backward,
# Line 135  Line 136 
136    
137    
138  void BitstreamWriteVolHeader(Bitstream * const bs,  void BitstreamWriteVolHeader(Bitstream * const bs,
139                                                           const MBParam * pParam);                                                           const MBParam * pParam,
140                                                             const FRAMEINFO * const frame,
141                                                             const int num_slices);
142    
143  void BitstreamWriteVopHeader(Bitstream * const bs,  void BitstreamWriteVopHeader(Bitstream * const bs,
144                                                           const MBParam * pParam,                                                           const MBParam * pParam,
145                                                           const FRAMEINFO * const frame,                                                           const FRAMEINFO * const frame,
146                                                           int vop_coded);                                                           int vop_coded,
147                                                             unsigned int quant);
148    
149  void BitstreamWriteUserData(Bitstream * const bs,  void BitstreamWriteUserData(Bitstream * const bs,
150                                                          uint8_t * data,                                                          const char *data,
151                                                          const int length);                                                          const unsigned int length);
152    
153    void
154    BitstreamWriteEndOfSequence(Bitstream * const bs);
155    
156    void
157    BitstreamWriteGroupOfVopHeader(Bitstream * const bs,
158                                   const MBParam * pParam,
159                                   uint32_t is_closed_gov);
160    
161    void write_video_packet_header(Bitstream * const bs,
162                                   const MBParam * pParam,
163                                   const FRAMEINFO * const frame,
164                                   int mbnum);
165    
166    /*****************************************************************************
167     * Bitstream
168     ****************************************************************************/
169    
170    /* Input buffer should be readable as full chunks of 8bytes, including
171    the end of the buffer. Padding might be appropriate. If only chunks
172    of 4bytes are applicable, define XVID_SAFE_BS_TAIL. Note that this will
173    slow decoding, so consider this as a last-resort solution */
174    /* #define XVID_SAFE_BS_TAIL */
175    
176  /* initialise bitstream structure */  /* initialise bitstream structure */
177    
# Line 177  Line 204 
204  #endif  #endif
205          bs->bufb = tmp;          bs->bufb = tmp;
206    
207            bs->pos = bs->initpos = (uint32_t) bitpos*8;
208            /* preserve the intervening bytes */
209            if (bs->initpos > 0)
210                    bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));
211            else
212          bs->buf = 0;          bs->buf = 0;
         bs->pos = bs->initpos = bitpos*8;  
213          bs->length = length;          bs->length = length;
214  }  }
215    
# Line 204  Line 235 
235  #endif  #endif
236          bs->bufb = tmp;          bs->bufb = tmp;
237    
238            /* preserve the intervening bytes */
239            if (bs->initpos > 0)
240                    bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));
241            else
242          bs->buf = 0;          bs->buf = 0;
243          bs->pos = bs->initpos;          bs->pos = bs->initpos;
244  }  }
# Line 239  Line 274 
274                  uint32_t tmp;                  uint32_t tmp;
275    
276                  bs->bufa = bs->bufb;                  bs->bufa = bs->bufb;
277    #if defined(XVID_SAFE_BS_TAIL)
278                    if (bs->tail<(bs->start+((bs->length+3)>>2)))
279    #endif
280                    {
281                  tmp = *((uint32_t *) bs->tail + 2);                  tmp = *((uint32_t *) bs->tail + 2);
282  #ifndef ARCH_IS_BIG_ENDIAN  #ifndef ARCH_IS_BIG_ENDIAN
283                  BSWAP(tmp);                  BSWAP(tmp);
284  #endif  #endif
285                  bs->bufb = tmp;                  bs->bufb = tmp;
286                  bs->tail++;                  bs->tail++;
287                    }
288    #if defined(XVID_SAFE_BS_TAIL)
289                    else {
290                            bs->bufb = 0;
291                    }
292    #endif
293                  bs->pos -= 32;                  bs->pos -= 32;
294          }          }
295  }  }

Legend:
Removed from v.1.17.2.3  
changed lines
  Added in v.1.26

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.4