From b82cdc727855fc11f0110c46c39eadd00009ebc0 Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Wed, 14 May 2003 12:32:17 +0000
Subject: [PATCH] make sh4 IDCT optional, so the user can choose

Originally committed as revision 1878 to svn://svn.ffmpeg.org/ffmpeg/trunk
---
 libavcodec/avcodec.h         | 1 +
 libavcodec/sh4/dsputil_sh4.c | 9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 63511421ebb..1393275da81 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -844,6 +844,7 @@ typedef struct AVCodecContext {
 #define FF_IDCT_MLIB         6
 #define FF_IDCT_ARM          7
 #define FF_IDCT_ALTIVEC      8
+#define FF_IDCT_SH4          9
 
     /**
      * slice count.
diff --git a/libavcodec/sh4/dsputil_sh4.c b/libavcodec/sh4/dsputil_sh4.c
index 6cf5e72eaff..8ba5c64d27a 100644
--- a/libavcodec/sh4/dsputil_sh4.c
+++ b/libavcodec/sh4/dsputil_sh4.c
@@ -105,10 +105,13 @@ extern void dsputil_init_align(DSPContext* c, AVCodecContext *avctx);
 
 void dsputil_init_sh4(DSPContext* c, AVCodecContext *avctx)
 {
+	const int idct_algo= avctx->idct_algo;
 	dsputil_init_align(c,avctx);
 
 	c->clear_blocks = clear_blocks_sh4;
-	c->idct_put = idct_put;
-	c->idct_add = idct_add;
-	c->idct_permutation_type= FF_NO_IDCT_PERM; //FF_SIMPLE_IDCT_PERM; //FF_LIBMPEG2_IDCT_PERM;
+	if(idct_algo==FF_IDCT_AUTO || idct_algo==FF_IDCT_SH4){        
+		c->idct_put = idct_put;
+		c->idct_add = idct_add;
+		c->idct_permutation_type= FF_NO_IDCT_PERM; //FF_SIMPLE_IDCT_PERM; //FF_LIBMPEG2_IDCT_PERM;
+	}
 }
-- 
GitLab