[FFmpeg-cvslog] avcodec/ituh263enc: Simplify AIC handling

Andreas Rheinhardt git at videolan.org
Sat Jun 21 23:20:59 EEST 2025


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun May 25 21:10:41 2025 +0200| [7643269ec20e9481c44eafdf12e69302647d650f] | committer: Andreas Rheinhardt

avcodec/ituh263enc: Simplify AIC handling

Namely with block_index and block_wrap.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7643269ec20e9481c44eafdf12e69302647d650f
---

 libavcodec/ituh263enc.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

diff --git a/libavcodec/ituh263enc.c b/libavcodec/ituh263enc.c
index ae67907722..8126bf5c84 100644
--- a/libavcodec/ituh263enc.c
+++ b/libavcodec/ituh263enc.c
@@ -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)
 {
-    int x, y, wrap, a, c, pred_dc;
-    int16_t *dc_val;
+    const int wrap = s->c.block_wrap[n];
+    const int xy   = s->c.block_index[n];
+    int16_t *const dc_val = s->c.dc_val[0] + xy;
+    int pred_dc;
 
     /* 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
      * A X
      */
-    a = dc_val[(x - 1) + (y) * wrap];
-    c = dc_val[(x) + (y - 1) * wrap];
+    int a = dc_val[-1];
+    int c = dc_val[-wrap];
 
     /* No prediction outside GOB boundary */
     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;
 
     /* we assume pred is positive */
-    *dc_val_ptr = &dc_val[x + y * wrap];
+    *dc_val_ptr = dc_val;
     return pred_dc;
 }
 



More information about the ffmpeg-cvslog mailing list