From 8b1191cb43b627840d57568b36fdbfdc214f6070 Mon Sep 17 00:00:00 2001
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Date: Wed, 19 Mar 2025 13:26:37 +0100
Subject: [PATCH 68/77] avcodec/motion_est: Move ff_h263_round_chroma() to
 h263.h

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/h263.h             | 10 ++++++++++
 libavcodec/motion_est.c       |  1 +
 libavcodec/motion_est.h       | 10 ----------
 libavcodec/mpegvideo_dec.c    |  1 +
 libavcodec/mpegvideo_motion.c |  1 +
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/libavcodec/h263.h b/libavcodec/h263.h
index 27a5f31c59..59f937070e 100644
--- a/libavcodec/h263.h
+++ b/libavcodec/h263.h
@@ -27,6 +27,16 @@
 
 #define H263_GOB_HEIGHT(h) ((h) <= 400 ? 1 : (h) <= 800 ? 2 : 4)
 
+static inline int ff_h263_round_chroma(int x)
+{
+    //FIXME static or not?
+    static const uint8_t h263_chroma_roundtab[16] = {
+    //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
+        0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
+    };
+    return h263_chroma_roundtab[x & 0xf] + (x >> 3);
+}
+
 av_const int ff_h263_aspect_to_info(AVRational aspect);
 int16_t *ff_h263_pred_motion(MpegEncContext * s, int block, int dir,
                              int *px, int *py);
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index b2b888237b..db610c3245 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -32,6 +32,7 @@
 #include <limits.h>
 
 #include "avcodec.h"
+#include "h263.h"
 #include "mathops.h"
 #include "motion_est.h"
 #include "mpegutils.h"
diff --git a/libavcodec/motion_est.h b/libavcodec/motion_est.h
index 16975abfe1..fe3d61fafb 100644
--- a/libavcodec/motion_est.h
+++ b/libavcodec/motion_est.h
@@ -106,16 +106,6 @@ typedef struct MotionEstContext {
                              int size, int h);
 } MotionEstContext;
 
-static inline int ff_h263_round_chroma(int x)
-{
-    //FIXME static or not?
-    static const uint8_t h263_chroma_roundtab[16] = {
-    //  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15
-        0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1,
-    };
-    return h263_chroma_roundtab[x & 0xf] + (x >> 3);
-}
-
 /**
  * Performs one-time initialization of the MotionEstContext.
  */
diff --git a/libavcodec/mpegvideo_dec.c b/libavcodec/mpegvideo_dec.c
index 8c84b59c5e..4019b4f0da 100644
--- a/libavcodec/mpegvideo_dec.c
+++ b/libavcodec/mpegvideo_dec.c
@@ -32,6 +32,7 @@
 
 #include "avcodec.h"
 #include "decode.h"
+#include "h263.h"
 #include "h264chroma.h"
 #include "internal.h"
 #include "mpegutils.h"
diff --git a/libavcodec/mpegvideo_motion.c b/libavcodec/mpegvideo_motion.c
index 6e9368dd9c..edc4931092 100644
--- a/libavcodec/mpegvideo_motion.c
+++ b/libavcodec/mpegvideo_motion.c
@@ -29,6 +29,7 @@
 
 #include "avcodec.h"
 #include "h261.h"
+#include "h263.h"
 #include "mpegutils.h"
 #include "mpegvideo.h"
 #include "mpeg4videodec.h"
-- 
2.45.2