aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/arm
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-28 19:58:47 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>2024-03-31 00:08:43 +0100
commite4e6377afcd1a201573c970ebf16fe6eabde58a4 (patch)
tree7cdccd33cc3f3fa180a5e048a08ea8f1fe1b9b84 /libavcodec/arm
parent790f793844390ece526ff654dc1bdddff5f5b4e8 (diff)
downloadffmpeg-e4e6377afcd1a201573c970ebf16fe6eabde58a4.tar.gz
avcodec/arm/mpegvideo_arm: Use static_assert to check offsets
Also move AV_CHECK_OFFSET to its only user, namely lavc/arm/mpegvideo_arm.c and rename it to CHECK_OFFSET. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/arm')
-rw-r--r--libavcodec/arm/mpegvideo_arm.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/libavcodec/arm/mpegvideo_arm.c b/libavcodec/arm/mpegvideo_arm.c
index 008ef18eea..28a3f2cdd9 100644
--- a/libavcodec/arm/mpegvideo_arm.c
+++ b/libavcodec/arm/mpegvideo_arm.c
@@ -18,8 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <assert.h>
+
#include "libavutil/attributes.h"
-#include "libavutil/internal.h"
#include "libavutil/arm/cpu.h"
#include "libavcodec/avcodec.h"
#include "libavcodec/mpegvideo.h"
@@ -27,13 +28,16 @@
#include "asm-offsets.h"
#if HAVE_NEON
-AV_CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE);
-AV_CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE);
-AV_CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED);
-AV_CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX);
-AV_CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end,
- INTER_SCANTAB_RASTER_END);
-AV_CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC);
+#define CHECK_OFFSET(s, m, o) \
+ static_assert(offsetof(s, m) == o, \
+ "Hardcoded ASM offset of " #s " field " #o " needs to be updated.");
+CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE);
+CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE);
+CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED);
+CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX);
+CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end,
+ INTER_SCANTAB_RASTER_END);
+CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC);
#endif
void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,