Namely with block_index and block_wrap.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -572,26 +572,17 @@ static void h263p_encode_umotion(PutBitContext *pb, int val) · 571 unmodified lines | |||
| 572 | 572 | ||
| 573 | static int h263_pred_dc(MPVEncContext *const s, int n, int16_t **dc_val_ptr) | 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; | 575 | const int wrap = s->c.block_wrap[n]; |
| 576 | int16_t *dc_val; | 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 | /* find prediction */ | 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 | /* B C | 581 | /* B C |
| 591 | * A X | 582 | * A X |
| 592 | */ | 583 | */ |
| 593 | a = dc_val[(x - 1) + (y) * wrap]; | 584 | int a = dc_val[-1]; |
| 594 | c = dc_val[(x) + (y - 1) * wrap]; | 585 | int c = dc_val[-wrap]; |
| 595 | 586 | ||
| 596 | /* No prediction outside GOB boundary */ | 587 | /* No prediction outside GOB boundary */ |
| 597 | if (s->c.first_slice_line && n != 3) { | 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 | pred_dc = c; | 598 | pred_dc = c; |
| 608 | 599 | ||
| 609 | /* we assume pred is positive */ | 600 | /* we assume pred is positive */ |
| 610 | *dc_val_ptr = &dc_val[x + y * wrap]; | 601 | *dc_val_ptr = dc_val; |
| 611 | return pred_dc; | 602 | return pred_dc; |
| 612 | } | 603 | } |
| 613 | 604 | ||