diff --git a/libavcodec/hq_hqa.c b/libavcodec/hq_hqa.c
index b63901aaef266f47a9ed4c2a879ad19d5377f79a..4b18eaef7836a390c94f5a6724b3f724f6c8461e 100644
--- a/libavcodec/hq_hqa.c
+++ b/libavcodec/hq_hqa.c
@@ -255,7 +255,8 @@ static int hqa_decode_frame(HQContext *ctx, AVFrame *pic, size_t data_size)
 
     av_log(ctx->avctx, AV_LOG_VERBOSE, "HQA Profile\n");
 
-    quant = bytestream2_get_be32(&ctx->gbc);
+    quant = bytestream2_get_byte(&ctx->gbc);
+    bytestream2_skip(&ctx->gbc, 3);
     if (quant >= NUM_HQ_QUANTS) {
         av_log(ctx->avctx, AV_LOG_ERROR,
                "Invalid quantization matrix %d.\n", quant);