diff --git a/libavcodec/mathops.h b/libavcodec/mathops.h
index df692fdfd31cc94be84aa0bf20005f710b5255a0..917112b86ecc8b66315ed52fade343b0f351973b 100644
--- a/libavcodec/mathops.h
+++ b/libavcodec/mathops.h
@@ -146,5 +146,13 @@ if ((y) < (x)) {\
 #   define NEG_USR32(a,s) (((uint32_t)(a))>>(32-(s)))
 #endif
 
+#ifndef PACK4x8
+# if HAVE_BIGENDIAN
+#  define PACK4x8(a,b,c,d) (((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
+# else
+#  define PACK4x8(a,b,c,d) (((d) << 24) | ((c) << 16) | ((b) << 8) | (a))
+# endif
+#endif
+
 #endif /* AVCODEC_MATHOPS_H */