Originally committed as revision 23304 to svn://svn.ffmpeg.org/ffmpeg/trunk
Unified · Split
| @@ -378,8 +378,15 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb) · 377 unmodified lines | ||
| 378 | 378 | } else { |
| 379 | 379 | |
| 380 | 380 | /* unpack the list of partially-coded superblocks */ |
| 381 | − bit = get_bits1(gb); | |
| 381 | + bit = get_bits1(gb) ^ 1; | |
| 382 | + current_run = 0; | |
| 383 | + | |
| 382 | 384 | while (current_superblock < s->superblock_count && get_bits_left(gb) > 0) { |
| 385 | + if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) | |
| 386 | + bit = get_bits1(gb); | |
| 387 | + else | |
| 388 | + bit ^= 1; | |
| 389 | + | |
| 383 | 390 | current_run = get_vlc2(gb, |
| 384 | 391 | s->superblock_run_length_vlc.table, 6, 2) + 1; |
| 385 | 392 | if (current_run == 34) |
| @@ -395,11 +402,6 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb) · 9 unmodified lines | ||
| 395 | 402 | current_superblock += current_run; |
| 396 | 403 | if (bit) |
| 397 | 404 | num_partial_superblocks += current_run; |
| 398 | − | |
| 399 | − if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) | |
| 400 | − bit = get_bits1(gb); | |
| 401 | − else | |
| 402 | − bit ^= 1; | |
| 403 | 405 | } |
| 404 | 406 | |
| 405 | 407 | /* unpack the list of fully coded superblocks if any of the blocks were |
| @@ -408,9 +410,17 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb) · 2 unmodified lines | ||
| 408 | 410 | int superblocks_decoded = 0; |
| 409 | 411 | |
| 410 | 412 | current_superblock = 0; |
| 411 | − bit = get_bits1(gb); | |
| 413 | + bit = get_bits1(gb) ^ 1; | |
| 414 | + current_run = 0; | |
| 415 | + | |
| 412 | 416 | while (superblocks_decoded < s->superblock_count - num_partial_superblocks |
| 413 | 417 | && get_bits_left(gb) > 0) { |
| 418 | + | |
| 419 | + if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) | |
| 420 | + bit = get_bits1(gb); | |
| 421 | + else | |
| 422 | + bit ^= 1; | |
| 423 | + | |
| 414 | 424 | current_run = get_vlc2(gb, |
| 415 | 425 | s->superblock_run_length_vlc.table, 6, 2) + 1; |
| 416 | 426 | if (current_run == 34) |
| @@ -429,11 +439,6 @@ static int unpack_superblocks(Vp3DecodeContext *s, GetBitContext *gb) · 12 unmodified lines | ||
| 429 | 439 | } |
| 430 | 440 | } |
| 431 | 441 | superblocks_decoded += current_run; |
| 432 | − | |
| 433 | − if (s->theora && current_run == MAXIMUM_LONG_BIT_RUN) | |
| 434 | − bit = get_bits1(gb); | |
| 435 | − else | |
| 436 | − bit ^= 1; | |
| 437 | 442 | } |
| 438 | 443 | } |
| 439 | 444 | |
| @@ -800,9 +805,15 @@ static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb) · 360 unmodified lines | ||
| 800 | 805 | for (qpi = 0; qpi < s->nqps-1 && num_blocks > 0; qpi++) { |
| 801 | 806 | i = blocks_decoded = num_blocks_at_qpi = 0; |
| 802 | 807 | |
| 803 | − bit = get_bits1(gb); | |
| 808 | + bit = get_bits1(gb) ^ 1; | |
| 809 | + run_length = 0; | |
| 804 | 810 | |
| 805 | 811 | do { |
| 812 | + if (run_length == MAXIMUM_LONG_BIT_RUN) | |
| 813 | + bit = get_bits1(gb); | |
| 814 | + else | |
| 815 | + bit ^= 1; | |
| 816 | + | |
| 806 | 817 | run_length = get_vlc2(gb, s->superblock_run_length_vlc.table, 6, 2) + 1; |
| 807 | 818 | if (run_length == 34) |
| 808 | 819 | run_length += get_bits(gb, 12); |
| @@ -820,11 +831,6 @@ static int unpack_block_qpis(Vp3DecodeContext *s, GetBitContext *gb) · 11 unmodified lines | ||
| 820 | 831 | j++; |
| 821 | 832 | } |
| 822 | 833 | } |
| 823 | − | |
| 824 | − if (run_length == MAXIMUM_LONG_BIT_RUN) | |
| 825 | − bit = get_bits1(gb); | |
| 826 | − else | |
| 827 | − bit ^= 1; | |
| 828 | 834 | } while (blocks_decoded < num_blocks && get_bits_left(gb) > 0); |
| 829 | 835 | |
| 830 | 836 | num_blocks -= num_blocks_at_qpi; |