diff --git a/libavcodec/jpeg2000.h b/libavcodec/jpeg2000.h
index c1303f24d8145ee01c8aceb5b246291e98af438e..24395a24ebe02e83d9da614890c80dbc32772f8b 100644
--- a/libavcodec/jpeg2000.h
+++ b/libavcodec/jpeg2000.h
@@ -124,7 +124,7 @@ enum Jpeg2000Quantsty { // quantization style
 
 typedef struct Jpeg2000T1Context {
     int data[JPEG2000_MAX_CBLKW][JPEG2000_MAX_CBLKH];
-    int flags[JPEG2000_MAX_CBLKW + 2][JPEG2000_MAX_CBLKH + 2];
+    uint16_t flags[JPEG2000_MAX_CBLKW + 2][JPEG2000_MAX_CBLKH + 2];
     MqcState mqc;
 } Jpeg2000T1Context;