vp9: assert -> av_assert and fix associated compile error.
[ffmpeg.git] / libavcodec / qpeldsp.c
index 7b51ce2..6e52b33 100644 (file)
@@ -1,20 +1,22 @@
 /*
  * quarterpel DSP functions
+ * Copyright (c) 2000, 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
  *
- * This file is part of Libav.
+ * This file is part of FFmpeg.
  *
- * Libav is free software; you can redistribute it and/or
+ * FFmpeg is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * Libav is distributed in the hope that it will be useful,
+ * FFmpeg is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with Libav; if not, write to the Free Software
+ * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 #include "libavutil/attributes.h"
 #include "copy_block.h"
 #include "qpeldsp.h"
+#include "diracdsp.h"
 
 #define BIT_DEPTH 8
 #include "hpel_template.c"
-#include "tpel_template.c"
+#include "pel_template.c"
 #include "qpel_template.c"
 
 #define QPEL_MC(r, OPNAME, RND, OP)                                           \
-static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src,       \
+static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, const uint8_t *src, \
                                             int dstStride, int srcStride,     \
                                             int h)                            \
 {                                                                             \
@@ -58,7 +61,7 @@ static void OPNAME ## mpeg4_qpel8_h_lowpass(uint8_t *dst, uint8_t *src,       \
     }                                                                         \
 }                                                                             \
                                                                               \
-static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src,       \
+static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, const uint8_t *src, \
                                             int dstStride, int srcStride)     \
 {                                                                             \
     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;                           \
@@ -88,7 +91,8 @@ static void OPNAME ## mpeg4_qpel8_v_lowpass(uint8_t *dst, uint8_t *src,       \
     }                                                                         \
 }                                                                             \
                                                                               \
-static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src,      \
+static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst,                    \
+                                             const uint8_t *src,              \
                                              int dstStride, int srcStride,    \
                                              int h)                           \
 {                                                                             \
@@ -117,7 +121,8 @@ static void OPNAME ## mpeg4_qpel16_h_lowpass(uint8_t *dst, uint8_t *src,      \
     }                                                                         \
 }                                                                             \
                                                                               \
-static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src,      \
+static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst,                    \
+                                             const uint8_t *src,              \
                                              int dstStride, int srcStride)    \
 {                                                                             \
     const uint8_t *cm = ff_crop_tab + MAX_NEG_CROP;                           \
@@ -163,7 +168,7 @@ static void OPNAME ## mpeg4_qpel16_v_lowpass(uint8_t *dst, uint8_t *src,      \
     }                                                                         \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc10_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t half[64];                                                         \
@@ -172,13 +177,13 @@ static void OPNAME ## qpel8_mc10_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, src, half, stride, stride, 8, 8);             \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc20_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc20_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     OPNAME ## mpeg4_qpel8_h_lowpass(dst, src, stride, stride, 8);             \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc30_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t half[64];                                                         \
@@ -187,7 +192,7 @@ static void OPNAME ## qpel8_mc30_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, src + 1, half, stride, stride, 8, 8);         \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc01_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -198,7 +203,7 @@ static void OPNAME ## qpel8_mc01_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8);                \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc02_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -207,7 +212,7 @@ static void OPNAME ## qpel8_mc02_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16);                   \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc03_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc03_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -218,7 +223,7 @@ static void OPNAME ## qpel8_mc03_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, full + 16, half, stride, 16, 8, 8);           \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -234,7 +239,7 @@ void ff_ ## OPNAME ## qpel8_mc11_old_c(uint8_t *dst, uint8_t *src,            \
                            stride, 16, 8, 8, 8, 8);                           \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc11_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -248,7 +253,7 @@ static void OPNAME ## qpel8_mc11_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);              \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -264,7 +269,7 @@ void ff_ ## OPNAME ## qpel8_mc31_old_c(uint8_t *dst, uint8_t *src,            \
                            stride, 16, 8, 8, 8, 8);                           \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc31_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -278,7 +283,7 @@ static void OPNAME ## qpel8_mc31_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);              \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -294,7 +299,7 @@ void ff_ ## OPNAME ## qpel8_mc13_old_c(uint8_t *dst, uint8_t *src,            \
                            stride, 16, 8, 8, 8, 8);                           \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc13_c(uint8_t *dst, const uint8_t *src,    \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -308,7 +313,7 @@ static void OPNAME ## qpel8_mc13_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH + 8, halfHV, stride, 8, 8, 8);          \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -324,7 +329,7 @@ void ff_ ## OPNAME ## qpel8_mc33_old_c(uint8_t *dst, uint8_t *src,            \
                            stride, 16, 8, 8, 8, 8);                           \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc33_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -338,7 +343,7 @@ static void OPNAME ## qpel8_mc33_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH + 8, halfHV, stride, 8, 8, 8);          \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc21_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t halfH[72];                                                        \
@@ -349,7 +354,7 @@ static void OPNAME ## qpel8_mc21_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH, halfHV, stride, 8, 8, 8);              \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc23_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t halfH[72];                                                        \
@@ -360,7 +365,7 @@ static void OPNAME ## qpel8_mc23_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## pixels8_l2_8(dst, halfH + 8, halfHV, stride, 8, 8, 8);          \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -375,7 +380,7 @@ void ff_ ## OPNAME ## qpel8_mc12_old_c(uint8_t *dst, uint8_t *src,            \
     OPNAME ## pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);              \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc12_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -387,7 +392,7 @@ static void OPNAME ## qpel8_mc12_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);                   \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src,            \
+void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, const uint8_t *src,      \
                                        ptrdiff_t stride)                      \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -402,7 +407,7 @@ void ff_ ## OPNAME ## qpel8_mc32_old_c(uint8_t *dst, uint8_t *src,            \
     OPNAME ## pixels8_l2_8(dst, halfV, halfHV, stride, 8, 8, 8);              \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc32_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t full[16 * 9];                                                     \
@@ -414,7 +419,7 @@ static void OPNAME ## qpel8_mc32_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);                   \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src,                \
+static void OPNAME ## qpel8_mc22_c(uint8_t *dst, const uint8_t *src,          \
                                    ptrdiff_t stride)                          \
 {                                                                             \
     uint8_t halfH[72];                                                        \
@@ -423,7 +428,7 @@ static void OPNAME ## qpel8_mc22_c(uint8_t *dst, uint8_t *src,                \
     OPNAME ## mpeg4_qpel8_v_lowpass(dst, halfH, stride, 8);                   \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc10_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t half[256];                                                        \
@@ -432,13 +437,13 @@ static void OPNAME ## qpel16_mc10_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, src, half, stride, stride, 16, 16);          \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc20_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc20_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     OPNAME ## mpeg4_qpel16_h_lowpass(dst, src, stride, stride, 16);           \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc30_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t half[256];                                                        \
@@ -447,7 +452,7 @@ static void OPNAME ## qpel16_mc30_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, src + 1, half, stride, stride, 16, 16);      \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc01_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -458,7 +463,7 @@ static void OPNAME ## qpel16_mc01_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16);             \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc02_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -467,7 +472,7 @@ static void OPNAME ## qpel16_mc02_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24);                  \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc03_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc03_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -478,7 +483,7 @@ static void OPNAME ## qpel16_mc03_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, full + 24, half, stride, 24, 16, 16);        \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -494,7 +499,7 @@ void ff_ ## OPNAME ## qpel16_mc11_old_c(uint8_t *dst, uint8_t *src,           \
                             stride, 24, 16, 16, 16, 16);                      \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc11_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -508,7 +513,7 @@ static void OPNAME ## qpel16_mc11_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);          \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -524,7 +529,7 @@ void ff_ ## OPNAME ## qpel16_mc31_old_c(uint8_t *dst, uint8_t *src,           \
                             stride, 24, 16, 16, 16, 16);                      \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc31_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -538,7 +543,7 @@ static void OPNAME ## qpel16_mc31_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);          \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -554,7 +559,7 @@ void ff_ ## OPNAME ## qpel16_mc13_old_c(uint8_t *dst, uint8_t *src,           \
                             stride, 24, 16, 16, 16, 16);                      \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc13_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -568,7 +573,7 @@ static void OPNAME ## qpel16_mc13_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH + 16, halfHV, stride, 16, 16, 16);     \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -584,7 +589,7 @@ void ff_ ## OPNAME ## qpel16_mc33_old_c(uint8_t *dst, uint8_t *src,           \
                             stride, 24, 16, 16, 16, 16);                      \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc33_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -598,7 +603,7 @@ static void OPNAME ## qpel16_mc33_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH + 16, halfHV, stride, 16, 16, 16);     \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc21_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t halfH[272];                                                       \
@@ -609,7 +614,7 @@ static void OPNAME ## qpel16_mc21_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH, halfHV, stride, 16, 16, 16);          \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc23_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t halfH[272];                                                       \
@@ -620,7 +625,7 @@ static void OPNAME ## qpel16_mc23_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## pixels16_l2_8(dst, halfH + 16, halfHV, stride, 16, 16, 16);     \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -635,7 +640,7 @@ void ff_ ## OPNAME ## qpel16_mc12_old_c(uint8_t *dst, uint8_t *src,           \
     OPNAME ## pixels16_l2_8(dst, halfV, halfHV, stride, 16, 16, 16);          \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc12_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -647,7 +652,7 @@ static void OPNAME ## qpel16_mc12_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);                 \
 }                                                                             \
                                                                               \
-void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src,           \
+void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, const uint8_t *src,     \
                                         ptrdiff_t stride)                     \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -662,7 +667,7 @@ void ff_ ## OPNAME ## qpel16_mc32_old_c(uint8_t *dst, uint8_t *src,           \
     OPNAME ## pixels16_l2_8(dst, halfV, halfHV, stride, 16, 16, 16);          \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc32_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t full[24 * 17];                                                    \
@@ -674,7 +679,7 @@ static void OPNAME ## qpel16_mc32_c(uint8_t *dst, uint8_t *src,               \
     OPNAME ## mpeg4_qpel16_v_lowpass(dst, halfH, stride, 16);                 \
 }                                                                             \
                                                                               \
-static void OPNAME ## qpel16_mc22_c(uint8_t *dst, uint8_t *src,               \
+static void OPNAME ## qpel16_mc22_c(uint8_t *dst, const uint8_t *src,         \
                                     ptrdiff_t stride)                         \
 {                                                                             \
     uint8_t halfH[272];                                                       \
@@ -695,22 +700,22 @@ QPEL_MC(0, avg_, _, op_avg)
 #undef op_put
 #undef op_put_no_rnd
 
-void ff_put_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_put_pixels8x8_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
 {
     put_pixels8_8_c(dst, src, stride, 8);
 }
 
-void ff_avg_pixels8x8_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_avg_pixels8x8_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
 {
     avg_pixels8_8_c(dst, src, stride, 8);
 }
 
-void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_put_pixels16x16_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
 {
     put_pixels16_8_c(dst, src, stride, 16);
 }
 
-void ff_avg_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride)
+void ff_avg_pixels16x16_c(uint8_t *dst, const uint8_t *src, ptrdiff_t stride)
 {
     avg_pixels16_8_c(dst, src, stride, 16);
 }
@@ -730,6 +735,51 @@ void ff_put_pixels8_l2_8(uint8_t *dst, const uint8_t *src1, const uint8_t *src2,
 
 }
 
+#if CONFIG_DIRAC_DECODER
+#define DIRAC_MC(OPNAME)\
+void ff_ ## OPNAME ## _dirac_pixels8_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+     OPNAME ## _pixels8_8_c(dst, src[0], stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels16_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_8_c(dst, src[0], stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels32_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_8_c(dst   , src[0]   , stride, h);\
+    OPNAME ## _pixels16_8_c(dst+16, src[0]+16, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels8_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels8_l2_8(dst, src[0], src[1], stride, stride, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels16_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_l2_8(dst, src[0], src[1], stride, stride, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels32_l2_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_l2_8(dst   , src[0]   , src[1]   , stride, stride, stride, h);\
+    OPNAME ## _pixels16_l2_8(dst+16, src[0]+16, src[1]+16, stride, stride, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels8_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels8_l4_8(dst, src[0], src[1], src[2], src[3], stride, stride, stride, stride, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels16_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_l4_8(dst, src[0], src[1], src[2], src[3], stride, stride, stride, stride, stride, h);\
+}\
+void ff_ ## OPNAME ## _dirac_pixels32_l4_c(uint8_t *dst, const uint8_t *src[5], int stride, int h)\
+{\
+    OPNAME ## _pixels16_l4_8(dst   , src[0]   , src[1]   , src[2]   , src[3]   , stride, stride, stride, stride, stride, h);\
+    OPNAME ## _pixels16_l4_8(dst+16, src[0]+16, src[1]+16, src[2]+16, src[3]+16, stride, stride, stride, stride, stride, h);\
+}
+DIRAC_MC(put)
+DIRAC_MC(avg)
+#endif
+
 av_cold void ff_qpeldsp_init(QpelDSPContext *c)
 {
 #define dspfunc(PFX, IDX, NUM)                              \
@@ -761,4 +811,6 @@ av_cold void ff_qpeldsp_init(QpelDSPContext *c)
 
     if (ARCH_X86)
         ff_qpeldsp_init_x86(c);
+    if (ARCH_MIPS)
+        ff_qpeldsp_init_mips(c);
 }