[svn] / branches / release-1_1-branch / xvidcore / src / bitstream / bitstream.h Repository:
ViewVC logotype

Diff of /branches/release-1_1-branch/xvidcore/src/bitstream/bitstream.h

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

revision 1746, Wed Nov 1 07:12:26 2006 UTC revision 1747, Wed Nov 1 09:26:52 2006 UTC
# Line 19  Line 19 
19   *  along with this program ; if not, write to the Free Software   *  along with this program ; if not, write to the Free Software
20   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
21   *   *
22   * $Id: bitstream.h,v 1.22.2.1 2006-07-10 15:05:30 Isibaar Exp $   * $Id: bitstream.h,v 1.22.2.2 2006-11-01 09:26:52 Isibaar Exp $
23   *   *
24   ****************************************************************************/   ****************************************************************************/
25    
# Line 162  Line 162 
162                                 const FRAMEINFO * const frame,                                 const FRAMEINFO * const frame,
163                                 int mbnum);                                 int mbnum);
164    
165    /*****************************************************************************
166     * Bitstream
167     ****************************************************************************/
168    
169    /* Input buffer should be readable as full chunks of 8bytes, including
170    the end of the buffer. Padding might be appropriate. If only chunks
171    of 4bytes are applicable, define XVID_SAFE_BS_TAIL. Note that this will
172    slow decoding, so consider this as a last-resort solution */
173    /* #define XVID_SAFE_BS_TAIL */
174    
175  /* initialise bitstream structure */  /* initialise bitstream structure */
176    
177  static void __inline  static void __inline
# Line 193  Line 203 
203  #endif  #endif
204          bs->bufb = tmp;          bs->bufb = tmp;
205    
206            bs->pos = bs->initpos = bitpos*8;
207          /* preserve the intervening bytes */          /* preserve the intervening bytes */
208          if (bs->initpos > 0)          if (bs->initpos > 0)
209                  bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));                  bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));
210          else          else
211                  bs->buf = 0;                  bs->buf = 0;
   
         bs->pos = bs->initpos = bitpos*8;  
212          bs->length = length;          bs->length = length;
213  }  }
214    
# Line 230  Line 239 
239                  bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));                  bs->buf = bs->bufa & (0xffffffff << (32 - bs->initpos));
240          else          else
241                  bs->buf = 0;                  bs->buf = 0;
   
242          bs->pos = bs->initpos;          bs->pos = bs->initpos;
243  }  }
244    
# Line 265  Line 273 
273                  uint32_t tmp;                  uint32_t tmp;
274    
275                  bs->bufa = bs->bufb;                  bs->bufa = bs->bufb;
276    #if defined(XVID_SAFE_BS_TAIL)
277                    if (bs->tail<(bs->start+((bs->length+3)>>2)))
278    #endif
279                    {
280                  tmp = *((uint32_t *) bs->tail + 2);                  tmp = *((uint32_t *) bs->tail + 2);
281  #ifndef ARCH_IS_BIG_ENDIAN  #ifndef ARCH_IS_BIG_ENDIAN
282                  BSWAP(tmp);                  BSWAP(tmp);
283  #endif  #endif
284                  bs->bufb = tmp;                  bs->bufb = tmp;
285                  bs->tail++;                  bs->tail++;
286                    }
287    #if defined(XVID_SAFE_BS_TAIL)
288                    else {
289                            bs->bufb = 0;
290                    }
291    #endif
292                  bs->pos -= 32;                  bs->pos -= 32;
293          }          }
294  }  }

Legend:
Removed from v.1746  
changed lines
  Added in v.1747

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