History

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.

Andreas Rheinhardt committed 2 years ago

Commit e4e63771 parent 790f7932 files · +12 −16Browse files

Showing the changes to libavcodec/arm (1 of 2 files). Show all

Unified · Split

libavcodec/arm/mpegvideo_arm.c+12−8
@@ -18,8 +18,9 @@ · 17 unmodified lines
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */19 */
20 20
21#include <assert.h>
22
21#include "libavutil/attributes.h"23#include "libavutil/attributes.h"
22#include "libavutil/internal.h"
23#include "libavutil/arm/cpu.h"24#include "libavutil/arm/cpu.h"
24#include "libavcodec/avcodec.h"25#include "libavcodec/avcodec.h"
25#include "libavcodec/mpegvideo.h"26#include "libavcodec/mpegvideo.h"
@@ -27,13 +28,16 @@ · 1 unmodified line
27#include "asm-offsets.h"28#include "asm-offsets.h"
28 29
29#if HAVE_NEON30#if HAVE_NEON
30AV_CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE);31#define CHECK_OFFSET(s, m, o) \
31AV_CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE);32 static_assert(offsetof(s, m) == o, \
32AV_CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED);33 "Hardcoded ASM offset of " #s " field " #o " needs to be updated.");
33AV_CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX);34CHECK_OFFSET(MpegEncContext, y_dc_scale, Y_DC_SCALE);
34AV_CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end,35CHECK_OFFSET(MpegEncContext, c_dc_scale, C_DC_SCALE);
35 INTER_SCANTAB_RASTER_END);36CHECK_OFFSET(MpegEncContext, ac_pred, AC_PRED);
36AV_CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC);37CHECK_OFFSET(MpegEncContext, block_last_index, BLOCK_LAST_INDEX);
38CHECK_OFFSET(MpegEncContext, inter_scantable.raster_end,
39 INTER_SCANTAB_RASTER_END);
40CHECK_OFFSET(MpegEncContext, h263_aic, H263_AIC);
37#endif41#endif
38 42
39void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,43void ff_dct_unquantize_h263_inter_neon(MpegEncContext *s, int16_t *block,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t