diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index d995222..a06b6d3 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -48,6 +48,7 @@ typedef struct DNXHDContext {
     ScanTable scantable;
     const CIDEntry *cid_table;
     int initialized_for_bits; // 8, 10 or 0 if not initialized at all.
+    int dnx8bit_idct_algo;
     void (*idct_put)(struct DNXHDContext* ctx, uint8_t * dest/*align 16*/, int line_size, DCTELEM *block/*align 16*/);
 } DNXHDContext;
 
@@ -74,6 +75,7 @@ static av_cold int dnxhd_decode_init(AVCodecContext *avctx)
     avcodec_get_frame_defaults(&ctx->picture);
     ctx->picture.type = AV_PICTURE_TYPE_I;
     ctx->picture.key_frame = 1;
+    ctx->dnx8bit_idct_algo = avctx->idct_algo;
     return 0;
 }
 
@@ -140,7 +142,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, const uint8_t *buf, int buf_si
     } else {
         ctx->avctx->pix_fmt = PIX_FMT_YUV422P;
         if (ctx->initialized_for_bits != 8) {
-            ctx->avctx->idct_algo = FF_IDCT_AUTO;
+            ctx->avctx->idct_algo = ctx->dnx8bit_idct_algo;
             dsputil_init(&ctx->dsp, ctx->avctx);
             ctx->initialized_for_bits = 8;
             ctx->idct_put = &dnxhd_8bit_idct_put;
