1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

avcodec/ituh263enc: Simplify AIC handling

Namely with block_index and block_wrap.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-05-25 21:10:41 +02:00
parent 950137a7c8
commit 7643269ec2

View File

@ -572,26 +572,17 @@ static void h263p_encode_umotion(PutBitContext *pb, int val)
static int h263_pred_dc(MPVEncContext *const s, int n, int16_t **dc_val_ptr) static int h263_pred_dc(MPVEncContext *const s, int n, int16_t **dc_val_ptr)
{ {
int x, y, wrap, a, c, pred_dc; const int wrap = s->c.block_wrap[n];
int16_t *dc_val; const int xy = s->c.block_index[n];
int16_t *const dc_val = s->c.dc_val[0] + xy;
int pred_dc;
/* find prediction */ /* find prediction */
if (n < 4) {
x = 2 * s->c.mb_x + (n & 1);
y = 2 * s->c.mb_y + ((n & 2) >> 1);
wrap = s->c.b8_stride;
dc_val = s->c.dc_val[0];
} else {
x = s->c.mb_x;
y = s->c.mb_y;
wrap = s->c.mb_stride;
dc_val = s->c.dc_val[n - 4 + 1];
}
/* B C /* B C
* A X * A X
*/ */
a = dc_val[(x - 1) + (y) * wrap]; int a = dc_val[-1];
c = dc_val[(x) + (y - 1) * wrap]; int c = dc_val[-wrap];
/* No prediction outside GOB boundary */ /* No prediction outside GOB boundary */
if (s->c.first_slice_line && n != 3) { 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)
pred_dc = c; pred_dc = c;
/* we assume pred is positive */ /* we assume pred is positive */
*dc_val_ptr = &dc_val[x + y * wrap]; *dc_val_ptr = dc_val;
return pred_dc; return pred_dc;
} }