diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c
index fec12f94cac75d269907aef5ca03e32e921673f9..ec0f435610e3eebf4f9a4b280db2a1ec79b27f5a 100644
--- a/libavcodec/dpx.c
+++ b/libavcodec/dpx.c
@@ -92,6 +92,7 @@ static int decode_frame(AVCodecContext *avctx,
 
     // Need to end in 0x323 to read the bits per color
     buf += 3;
+    avctx->bits_per_raw_sample =
     bits_per_color = buf[0];
 
     switch (descriptor) {