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.23 2006-04-14 07:24:47 Skal Exp $ |
* $Id: bitstream.h,v 1.24 2006-09-03 08:46:56 Skal Exp $ |
23 |
* |
* |
24 |
****************************************************************************/ |
****************************************************************************/ |
25 |
|
|
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 |
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 |
} |
} |