Also move AV_CHECK_OFFSET to its only user, namely lavc/arm/mpegvideo_arm.c and rename it to CHECK_OFFSET.
Unified · Split
| @@ -18,8 +18,9 @@ · 17 unmodified lines | ||
| 18 | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | +#include <assert.h> | |
| 22 | + | |
| 21 | 23 | #include "libavutil/attributes.h" |
| 22 | −#include "libavutil/internal.h" | |
| 23 | 24 | #include "libavutil/arm/cpu.h" |
| 24 | 25 | #include "libavcodec/avcodec.h" |
| 25 | 26 | #include "libavcodec/mpegvideo.h" |
| @@ -27,13 +28,16 @@ · 1 unmodified line | ||
| 27 | 28 | #include "asm-offsets.h" |
| 28 | 29 | |
| 29 | 30 | #if HAVE_NEON |
| 30 | −AV_CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE); | |
| 31 | −AV_CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE); | |
| 32 | −AV_CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED); | |
| 33 | −AV_CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX); | |
| 34 | −AV_CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end, | |
| 35 | − INTER_SCANTAB_RASTER_END); | |
| 36 | −AV_CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC); | |
| 31 | +#define CHECK_OFFSET(s, m, o) \ | |
| 32 | + static_assert(offsetof(s, m) == o, \ | |
| 33 | + "Hardcoded ASM offset of " #s " field " #o " needs to be updated."); | |
| 34 | +CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE); | |
| 35 | +CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE); | |
| 36 | +CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED); | |
| 37 | +CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX); | |
| 38 | +CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end, | |
| 39 | + INTER_SCANTAB_RASTER_END); | |
| 40 | +CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC); | |
| 37 | 41 | #endif |
| 38 | 42 | |
| 39 | 43 | void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block, |
| @@ -76,14 +76,6 @@ · 75 unmodified lines | ||
| 76 | 76 | |
| 77 | 77 | #define FF_MEMORY_POISON 0x2a |
| 78 | 78 | |
| 79 | −/* Check if the hard coded offset of a struct member still matches reality. | |
| 80 | − * Induce a compilation failure if not. | |
| 81 | − */ | |
| 82 | −#define AV_CHECK_OFFSET(s, m, o) struct check_##o { \ | |
| 83 | − int x_##o[offsetof(s, m) == o? 1: -1]; \ | |
| 84 | − } | |
| 85 | − | |
| 86 | − | |
| 87 | 79 | #define FF_ALLOC_TYPED_ARRAY(p, nelem) (p = av_malloc_array(nelem, sizeof(*p))) |
| 88 | 80 | #define FF_ALLOCZ_TYPED_ARRAY(p, nelem) (p = av_calloc(nelem, sizeof(*p))) |
| 89 | 81 | |