Mercurial > libavcodec.hg
comparison mpegaudiodec.c @ 192:1e5f64be86fc libavcodec
another bitstream reader code (faster on intel cpus) - patch by Michael Niedermayer <michaelni@gmx.at>
author | uid46427 |
---|---|
date | Thu, 10 Jan 2002 00:56:05 +0000 |
parents | 35e3ced6cfd9 |
children | a0124152c89d |
comparison
equal
deleted
inserted
replaced
191:883f184537e6 | 192:1e5f64be86fc |
---|---|
1369 static void seek_to_maindata(MPADecodeContext *s, long backstep) | 1369 static void seek_to_maindata(MPADecodeContext *s, long backstep) |
1370 { | 1370 { |
1371 UINT8 *ptr; | 1371 UINT8 *ptr; |
1372 | 1372 |
1373 /* compute current position in stream */ | 1373 /* compute current position in stream */ |
1374 #ifdef ALT_BITSTREAM_READER | |
1375 ptr = s->gb.buffer + (s->gb.index>>3); | |
1376 #else | |
1374 ptr = s->gb.buf_ptr - (s->gb.bit_cnt >> 3); | 1377 ptr = s->gb.buf_ptr - (s->gb.bit_cnt >> 3); |
1378 #endif | |
1375 /* copy old data before current one */ | 1379 /* copy old data before current one */ |
1376 ptr -= backstep; | 1380 ptr -= backstep; |
1377 memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] + | 1381 memcpy(ptr, s->inbuf1[s->inbuf_index ^ 1] + |
1378 BACKSTEP_SIZE + s->old_frame_size - backstep, backstep); | 1382 BACKSTEP_SIZE + s->old_frame_size - backstep, backstep); |
1379 /* init get bits again */ | 1383 /* init get bits again */ |
1526 if (pos >= end_pos) { | 1530 if (pos >= end_pos) { |
1527 if (pos > end_pos && last_buf_ptr != NULL) { | 1531 if (pos > end_pos && last_buf_ptr != NULL) { |
1528 /* some encoders generate an incorrect size for this | 1532 /* some encoders generate an incorrect size for this |
1529 part. We must go back into the data */ | 1533 part. We must go back into the data */ |
1530 s_index -= 4; | 1534 s_index -= 4; |
1535 #ifdef ALT_BITSTREAM_READER | |
1536 s->gb.buffer = last_buf_ptr; | |
1537 s->gb.index = last_bit_cnt; | |
1538 #else | |
1531 s->gb.buf_ptr = last_buf_ptr; | 1539 s->gb.buf_ptr = last_buf_ptr; |
1532 s->gb.bit_buf = last_bit_buf; | 1540 s->gb.bit_buf = last_bit_buf; |
1533 s->gb.bit_cnt = last_bit_cnt; | 1541 s->gb.bit_cnt = last_bit_cnt; |
1542 #endif | |
1534 } | 1543 } |
1535 break; | 1544 break; |
1536 } | 1545 } |
1546 #ifdef ALT_BITSTREAM_READER | |
1547 last_buf_ptr = s->gb.buffer; | |
1548 last_bit_cnt = s->gb.index; | |
1549 #else | |
1537 last_buf_ptr = s->gb.buf_ptr; | 1550 last_buf_ptr = s->gb.buf_ptr; |
1538 last_bit_buf = s->gb.bit_buf; | 1551 last_bit_buf = s->gb.bit_buf; |
1539 last_bit_cnt = s->gb.bit_cnt; | 1552 last_bit_cnt = s->gb.bit_cnt; |
1553 #endif | |
1540 | 1554 |
1541 code = get_vlc(&s->gb, vlc); | 1555 code = get_vlc(&s->gb, vlc); |
1542 dprintf("t=%d code=%d\n", g->count1table_select, code); | 1556 dprintf("t=%d code=%d\n", g->count1table_select, code); |
1543 if (code < 0) | 1557 if (code < 0) |
1544 return -1; | 1558 return -1; |