diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index 878a6be1137c862e12e1ffd1e8673dd3900b6217..4cff0a9dd3fd0848c5a9c0a9f0f6fb80f3a7feb7 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -1819,35 +1819,6 @@ static void add_8x8basis_c(int16_t rem[64], int16_t basis[64], int scale){
     }
 }
 
-/**
- * Permute an 8x8 block.
- * @param block the block which will be permuted according to the given permutation vector
- * @param permutation the permutation vector
- * @param last the last non zero coefficient in scantable order, used to speed the permutation up
- * @param scantable the used scantable, this is only used to speed the permutation up, the block is not
- *                  (inverse) permutated to scantable order!
- */
-void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last)
-{
-    int i;
-    int16_t temp[64];
-
-    if(last<=0) return;
-    //if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations
-
-    for(i=0; i<=last; i++){
-        const int j= scantable[i];
-        temp[j]= block[j];
-        block[j]=0;
-    }
-
-    for(i=0; i<=last; i++){
-        const int j= scantable[i];
-        const int perm_j= permutation[j];
-        block[perm_j]= temp[j];
-    }
-}
-
 static int zero_cmp(void *s, uint8_t *a, uint8_t *b, int stride, int h){
     return 0;
 }
diff --git a/libavcodec/dsputil.h b/libavcodec/dsputil.h
index 1706af4a7d0eaf8d89cd0cc906e625e3a6e21496..47e5b58dc4f20e727eb869b8ea05c7d0a80e7a38 100644
--- a/libavcodec/dsputil.h
+++ b/libavcodec/dsputil.h
@@ -454,12 +454,6 @@ attribute_deprecated void dsputil_init(DSPContext* c, AVCodecContext *avctx);
 
 int ff_check_alignment(void);
 
-/**
- * permute block according to permuatation.
- * @param last last non zero element in scantable order
- */
-void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last);
-
 void ff_set_cmp(DSPContext* c, me_cmp_func *cmp, int type);
 
 #define         BYTE_VEC32(c)   ((c)*0x01010101UL)
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 00388dfdfa9223d40db996a00504f7656019aa6b..8ab0e683982190255029603a02c934479dda42f3 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -2881,6 +2881,35 @@ void ff_init_block_index(MpegEncContext *s){ //FIXME maybe rename
     }
 }
 
+/**
+ * Permute an 8x8 block.
+ * @param block the block which will be permuted according to the given permutation vector
+ * @param permutation the permutation vector
+ * @param last the last non zero coefficient in scantable order, used to speed the permutation up
+ * @param scantable the used scantable, this is only used to speed the permutation up, the block is not
+ *                  (inverse) permutated to scantable order!
+ */
+void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last)
+{
+    int i;
+    int16_t temp[64];
+
+    if(last<=0) return;
+    //if(permutation[1]==1) return; //FIXME it is ok but not clean and might fail for some permutations
+
+    for(i=0; i<=last; i++){
+        const int j= scantable[i];
+        temp[j]= block[j];
+        block[j]=0;
+    }
+
+    for(i=0; i<=last; i++){
+        const int j= scantable[i];
+        const int perm_j= permutation[j];
+        block[perm_j]= temp[j];
+    }
+}
+
 void ff_mpeg_flush(AVCodecContext *avctx){
     int i;
     MpegEncContext *s = avctx->priv_data;
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index ba352de3fdc96fb072f4499e4e4be97ee5573555..af59befd254dfbe441d26e3613f94487286cebcd 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -830,6 +830,12 @@ int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared);
 extern const enum AVPixelFormat ff_pixfmt_list_420[];
 extern const enum AVPixelFormat ff_hwaccel_pixfmt_list_420[];
 
+/**
+ * permute block according to permuatation.
+ * @param last last non zero element in scantable order
+ */
+void ff_block_permute(int16_t *block, uint8_t *permutation, const uint8_t *scantable, int last);
+
 static inline void ff_update_block_index(MpegEncContext *s){
     const int block_size= 8 >> s->avctx->lowres;