Namely with block_index and block_wrap.
Unified · Split
| @@ -572,26 +572,17 @@ static void h263p_encode_umotion(PutBitContext *pb, int val) · 571 unmodified lines | ||
| 572 | 572 | |
| 573 | 573 | static int h263_pred_dc(MPVEncContext *const s, int n, int16_t **dc_val_ptr) |
| 574 | 574 | { |
| 575 | − int x, y, wrap, a, c, pred_dc; | |
| 576 | − int16_t *dc_val; | |
| 575 | + const int wrap = s->c.block_wrap[n]; | |
| 576 | + const int xy = s->c.block_index[n]; | |
| 577 | + int16_t *const dc_val = s->c.dc_val[0] + xy; | |
| 578 | + int pred_dc; | |
| 577 | 579 | |
| 578 | 580 | /* find prediction */ |
| 579 | − if (n < 4) { | |
| 580 | − x = 2 * s->c.mb_x + (n & 1); | |
| 581 | − y = 2 * s->c.mb_y + ((n & 2) >> 1); | |
| 582 | − wrap = s->c.b8_stride; | |
| 583 | − dc_val = s->c.dc_val[0]; | |
| 584 | − } else { | |
| 585 | − x = s->c.mb_x; | |
| 586 | − y = s->c.mb_y; | |
| 587 | − wrap = s->c.mb_stride; | |
| 588 | − dc_val = s->c.dc_val[n - 4 + 1]; | |
| 589 | − } | |
| 590 | 581 | /* B C |
| 591 | 582 | * A X |
| 592 | 583 | */ |
| 593 | − a = dc_val[(x - 1) + (y) * wrap]; | |
| 594 | − c = dc_val[(x) + (y - 1) * wrap]; | |
| 584 | + int a = dc_val[-1]; | |
| 585 | + int c = dc_val[-wrap]; | |
| 595 | 586 | |
| 596 | 587 | /* No prediction outside GOB boundary */ |
| 597 | 588 | if (s->c.first_slice_line && n != 3) { |
| @@ -607,7 +598,7 @@ static int h263_pred_dc(MPVEncContext *const s, int n, int16_t **dc_val_ptr) · 9 unmodified lines | ||
| 607 | 598 | pred_dc = c; |
| 608 | 599 | |
| 609 | 600 | /* we assume pred is positive */ |
| 610 | − *dc_val_ptr = &dc_val[x + y * wrap]; | |
| 601 | + *dc_val_ptr = dc_val; | |
| 611 | 602 | return pred_dc; |
| 612 | 603 | } |
| 613 | 604 | |