[FFmpeg-cvslog] lavf/isom: Support EVRC in pvAuthor files.

2016-12-12 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Mon Dec 12 
11:37:06 2016 +0100| [9d068896d32280235e2f31f47a75bf1ba313ad1d] | committer: 
Carl Eugen Hoyos

lavf/isom: Support EVRC in pvAuthor files.

Fixes ticket #6014.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9d068896d32280235e2f31f47a75bf1ba313ad1d
---

 libavformat/isom.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index cd0b0b7..f669e0e 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -62,6 +62,7 @@ const AVCodecTag ff_mp4_obj_type[] = {
 { AV_CODEC_ID_VP9 , 0xC0 }, /* nonstandard, update when there is a 
standard value */
 { AV_CODEC_ID_FLAC, 0xC1 }, /* nonstandard, update when there is a 
standard value */
 { AV_CODEC_ID_TSCC2   , 0xD0 }, /* nonstandard, camtasia uses it */
+{ AV_CODEC_ID_EVRC, 0xD1 }, /* nonstandard, pvAuthor uses it */
 { AV_CODEC_ID_VORBIS  , 0xDD }, /* nonstandard, gpac uses it */
 { AV_CODEC_ID_DVD_SUBTITLE, 0xE0 }, /* nonstandard, see 
unsupported-embedded-subs-2.mp4 */
 { AV_CODEC_ID_QCELP   , 0xE1 },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] lavf/mov: Accept multiple fourcc for AVID 1:1.

2016-12-12 Thread Carl Eugen Hoyos
ffmpeg | branch: master | Carl Eugen Hoyos  | Mon Dec 12 
12:26:21 2016 +0100| [62eafc6a6dd8c51d6ecabdb3d649043950c4f01b] | committer: 
Carl Eugen Hoyos

lavf/mov: Accept multiple fourcc for AVID 1:1.

Fixes ticket #5982.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=62eafc6a6dd8c51d6ecabdb3d649043950c4f01b
---

 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0b1c182..6c8affc 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2220,6 +2220,8 @@ static int mov_skip_multiple_stsd(MOVContext *c, 
AVIOContext *pb,
 
 if (codec_tag &&
  (codec_tag != format &&
+  // AVID 1:1 samples with differing data format and codec tag exist
+  (codec_tag != AV_RL32("AV1x") || format != AV_RL32("AVup")) &&
   // prores is allowed to have differing data format and codec tag
   codec_tag != AV_RL32("apcn") && codec_tag != AV_RL32("apch") &&
   // so is dv (sigh)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cuvid: fix compilation with msvc11

2016-12-12 Thread Timo Rothenpieler
ffmpeg | branch: master | Timo Rothenpieler  | Mon Dec 
12 11:44:36 2016 +0100| [00223132e9660acd50478bd9e709b72c605ee6da] | committer: 
Timo Rothenpieler

avcodec/cuvid: fix compilation with msvc11

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00223132e9660acd50478bd9e709b72c605ee6da
---

 libavcodec/cuvid.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 94606a9..8fc713d 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -288,8 +288,9 @@ static int CUDAAPI cuvid_handle_picture_display(void 
*opaque, CUVIDPARSERDISPINF
 {
 AVCodecContext *avctx = opaque;
 CuvidContext *ctx = avctx->priv_data;
-CuvidParsedFrame parsed_frame = { *dispinfo, 0, 0 };
+CuvidParsedFrame parsed_frame = { { 0 } };
 
+parsed_frame.dispinfo = *dispinfo;
 ctx->internal_error = 0;
 
 if (ctx->deint_mode == cudaVideoDeinterlaceMode_Weave) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] fate: Add h264 test for frame num gaps

2016-12-12 Thread Derek Buitenhuis
ffmpeg | branch: master | Derek Buitenhuis  | Fri 
Dec  9 15:21:11 2016 +| [b7e4ea0c80f4b3e060625fd97ffdd3b9689bfcd1] | 
committer: Derek Buitenhuis

fate: Add h264 test for frame num gaps

Signed-off-by: Derek Buitenhuis 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7e4ea0c80f4b3e060625fd97ffdd3b9689bfcd1
---

 tests/fate/h264.mak   |  2 ++
 tests/ref/fate/h264-missing-frame | 35 +++
 2 files changed, 37 insertions(+)

diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index 718a3a8..d40681f 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -194,6 +194,7 @@ FATE_H264  := $(FATE_H264:%=fate-h264-conformance-%)
\
   fate-h264-intra-refresh-recovery  \
   fate-h264-lossless\
   fate-h264-3386\
+  fate-h264-missing-frame   \
 
 FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264)
 FATE_H264-$(call DEMDEC,  MOV, H264) += fate-h264-crop-to-container
@@ -432,6 +433,7 @@ fate-h264-lossless:   CMD = 
framecrc -i $(TARGET_SAM
 fate-h264-mixed-nal-coding:   CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/mixed-nal-coding.mp4
 fate-h264-unescaped-extradata:CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/unescaped_extradata.mp4 -an -frames 10
 fate-h264-3386:   CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/bbc2.sample.h264
+fate-h264-missing-frame:  CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/nondeterministic_cut.h264
 
 fate-h264-reinit-%:   CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/$(@:fate-h264-%=%).h264 -vf 
format=yuv444p10le,scale=w=352:h=288
 
diff --git a/tests/ref/fate/h264-missing-frame 
b/tests/ref/fate/h264-missing-frame
new file mode 100644
index 000..04d2299
--- /dev/null
+++ b/tests/ref/fate/h264-missing-frame
@@ -0,0 +1,35 @@
+#tb 0: 1/30
+#media_type 0: video
+#codec_id 0: rawvideo
+#dimensions 0: 1440x1080
+#sar 0: 1/1
+0,  0,  0,1,  2332800, 0x009dacb8
+0,  1,  1,1,  2332800, 0xb1e50764
+0,  2,  2,1,  2332800, 0xe29481e0
+0,  3,  3,1,  2332800, 0x0b1b4de4
+0,  4,  4,1,  2332800, 0x726a644c
+0,  5,  5,1,  2332800, 0x7a09c4a5
+0,  6,  6,1,  2332800, 0x2e9059ea
+0,  7,  7,1,  2332800, 0x52071fdc
+0,  8,  8,1,  2332800, 0x4fa00417
+0,  9,  9,1,  2332800, 0x6037fb4d
+0, 10, 10,1,  2332800, 0x887ffae2
+0, 11, 11,1,  2332800, 0x887ffae2
+0, 12, 12,1,  2332800, 0x887ffae2
+0, 13, 13,1,  2332800, 0x887ffae2
+0, 14, 14,1,  2332800, 0x887ffae2
+0, 15, 15,1,  2332800, 0x887ffae2
+0, 16, 16,1,  2332800, 0x887ffae2
+0, 17, 17,1,  2332800, 0x887ffae2
+0, 18, 18,1,  2332800, 0x887ffae2
+0, 19, 19,1,  2332800, 0x887ffae2
+0, 20, 20,1,  2332800, 0x887ffae2
+0, 21, 21,1,  2332800, 0x887ffae2
+0, 22, 22,1,  2332800, 0x887ffae2
+0, 23, 23,1,  2332800, 0x887ffae2
+0, 24, 24,1,  2332800, 0x887ffae2
+0, 25, 25,1,  2332800, 0x887ffae2
+0, 26, 26,1,  2332800, 0x887ffae2
+0, 27, 27,1,  2332800, 0x887ffae2
+0, 28, 28,1,  2332800, 0x887ffae2
+0, 29, 29,1,  2332800, 0x824bb91b

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] opt: reject denominator zero as out of range

2016-12-12 Thread Andreas Cadhalpun
ffmpeg | branch: master | Andreas Cadhalpun  
| Mon Dec 12 01:12:15 2016 +0100| [3ab8436ff611aa488226bbcb25c84bb687b2bf46] | 
committer: Andreas Cadhalpun

opt: reject denominator zero as out of range

Reviewed-by: Michael Niedermayer 
Signed-off-by: Andreas Cadhalpun 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ab8436ff611aa488226bbcb25c84bb687b2bf46
---

 libavutil/opt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index f855ccb..6ae2af6 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -97,7 +97,7 @@ static int read_number(const AVOption *o, const void *dst, 
double *num, int *den
 static int write_number(void *obj, const AVOption *o, void *dst, double num, 
int den, int64_t intnum)
 {
 if (o->type != AV_OPT_TYPE_FLAGS &&
-(o->max * den < num * intnum || o->min * den > num * intnum)) {
+(!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
 num = den ? num * intnum / den : (num * intnum ? INFINITY : NAN);
 av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range 
[%g - %g]\n",
num, o->name, o->min, o->max);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/tests/imgutils: Remove unused variable

2016-12-12 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer  | Mon 
Dec 12 23:45:54 2016 +0100| [4cf3def805cf522ddd9c24c24ef1246b008bac2c] | 
committer: Michael Niedermayer

avutil/tests/imgutils: Remove unused variable

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4cf3def805cf522ddd9c24c24ef1246b008bac2c
---

 libavutil/tests/imgutils.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/libavutil/tests/imgutils.c b/libavutil/tests/imgutils.c
index e51ecc6..571045c 100644
--- a/libavutil/tests/imgutils.c
+++ b/libavutil/tests/imgutils.c
@@ -22,7 +22,6 @@
 
 int main(void)
 {
-int i;
 int64_t x, y;
 
 for (y = -1; yhttp://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil: fix data race in av_get_cpu_flags()

2016-12-12 Thread Wan-Teh Chang
ffmpeg | branch: master | Wan-Teh Chang  | Tue 
Dec  6 18:16:13 2016 -0800| [fed50c4304eecb352e29ce789cdb96ea84d6162f] | 
committer: Michael Niedermayer

avutil: fix data race in av_get_cpu_flags()

Make the one-time initialization in av_get_cpu_flags() thread-safe. The
static variable |cpu_flags| in libavutil/cpu.c is read and written using
normal load and store operations. These are considered as data races.
The fix is to use atomic load and store operations.

The fix can be verified by running the libavutil/tests/cpu_init.c test
program under ThreadSanitizer:
./configure --toolchain=clang-tsan
make libavutil/tests/cpu_init
libavutil/tests/cpu_init

There should be no warnings from ThreadSanitizer.

Co-author: Dmitry Vyukov of Google, who suggested the data race fix.

Signed-off-by: Wan-Teh Chang 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fed50c4304eecb352e29ce789cdb96ea84d6162f
---

 libavutil/cpu.c | 12 +++-
 libavutil/cpu.h |  2 --
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/libavutil/cpu.c b/libavutil/cpu.c
index 73317c4..16e0c92 100644
--- a/libavutil/cpu.c
+++ b/libavutil/cpu.c
@@ -17,6 +17,7 @@
  */
 
 #include 
+#include 
 
 #include "cpu.h"
 #include "cpu_internal.h"
@@ -44,7 +45,7 @@
 #include 
 #endif
 
-static int cpu_flags = -1;
+static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
 
 static int get_cpu_flags(void)
 {
@@ -82,22 +83,23 @@ void av_force_cpu_flags(int arg){
 arg |= AV_CPU_FLAG_MMX;
 }
 
-cpu_flags = arg;
+atomic_store_explicit(&cpu_flags, arg, memory_order_relaxed);
 }
 
 int av_get_cpu_flags(void)
 {
-int flags = cpu_flags;
+int flags = atomic_load_explicit(&cpu_flags, memory_order_relaxed);
 if (flags == -1) {
 flags = get_cpu_flags();
-cpu_flags = flags;
+atomic_store_explicit(&cpu_flags, flags, memory_order_relaxed);
 }
 return flags;
 }
 
 void av_set_cpu_flags_mask(int mask)
 {
-cpu_flags = get_cpu_flags() & mask;
+atomic_store_explicit(&cpu_flags, get_cpu_flags() & mask,
+  memory_order_relaxed);
 }
 
 int av_parse_cpu_flags(const char *s)
diff --git a/libavutil/cpu.h b/libavutil/cpu.h
index 4bff167..8499f0e 100644
--- a/libavutil/cpu.h
+++ b/libavutil/cpu.h
@@ -85,8 +85,6 @@ void av_force_cpu_flags(int flags);
  * Set a mask on flags returned by av_get_cpu_flags().
  * This function is mainly useful for testing.
  * Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are 
more flexible
- *
- * @warning this function is not thread safe.
  */
 attribute_deprecated void av_set_cpu_flags_mask(int mask);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] configure: add -fPIE instead of -pie to C flags for ThreadSanitizer

2016-12-12 Thread Wan-Teh Chang
ffmpeg | branch: master | Wan-Teh Chang  | Fri 
Dec  2 14:04:53 2016 -0800| [3f55752cd566c68ff3d3ae984a3936c1d08ef8ca] | 
committer: Michael Niedermayer

configure: add -fPIE instead of -pie to C flags for ThreadSanitizer

-pie was added to C flags for ThreadSanitizer in commit
19f251a2882a8d0779b432e63bf282e4d9c443bb. Under clang 3.8.0, the -pie
flag causes a compiler warning and a linker error when running configure
--toolchain=clang-tsan. Here is an excerpt from config.log:

clang ... -fsanitize=thread -pie -std=c11 -fomit-frame-pointer -pthread -c -o 
/tmp/ffconf.hL61stP9.o /tmp/ffconf.YO6ZaSFG.c
clang: warning: argument unused during compilation: '-pie'
clang -fsanitize=thread -pie -Wl,--as-needed -Wl,-z,noexecstack -o 
/tmp/ffconf.W5c2e41l /tmp/ffconf.hL61stP9.o -lbz2 -pthread
/usr/bin/ld: /tmp/ffconf.hL61stP9.o: relocation R_X86_64_PC32 against undefined 
symbol `atan2f@@GLIBC_2.2.5' can not be used when making a shared object; 
recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

To be conservative, I changed -pie to -fPIE. But the documentation seems
to imply just -fsanitize=thread is enough:

http://clang.llvm.org/docs/ThreadSanitizer.html
https://github.com/google/sanitizers/wiki/ThreadSanitizerCppManual

Signed-off-by: Wan-Teh Chang 
Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3f55752cd566c68ff3d3ae984a3936c1d08ef8ca
---

 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 2fd6daf..9dfd006 100755
--- a/configure
+++ b/configure
@@ -3553,7 +3553,7 @@ case "$toolchain" in
 ;;
 *-tsan)
 cc_default="${toolchain%-tsan}"
-add_cflags  -fsanitize=thread -pie
+add_cflags  -fsanitize=thread -fPIE
 add_ldflags -fsanitize=thread -pie
 case "$toolchain" in
 gcc-tsan)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi

2016-12-12 Thread Zhou Xiaoyong
ffmpeg | branch: master | Zhou Xiaoyong  | Mon Oct 10 
16:10:59 2016 +0800| [d84e635d0690e685a35f2257a93caf7216ae8e47] | committer: 
Michael Niedermayer

avcodec/mips: version 1 of wmv2dsp optimizations for loongson mmi

Signed-off-by: Michael Niedermayer 

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d84e635d0690e685a35f2257a93caf7216ae8e47
---

 libavcodec/mips/Makefile|   2 +
 libavcodec/mips/wmv2dsp_init_mips.c |  38 +
 libavcodec/mips/wmv2dsp_mips.h  |  29 
 libavcodec/mips/wmv2dsp_mmi.c   | 278 
 libavcodec/wmv2dsp.c|   3 +
 libavcodec/wmv2dsp.h|   1 +
 6 files changed, 351 insertions(+)

diff --git a/libavcodec/mips/Makefile b/libavcodec/mips/Makefile
index cf54f38..2b6f37e 100644
--- a/libavcodec/mips/Makefile
+++ b/libavcodec/mips/Makefile
@@ -36,6 +36,7 @@ OBJS-$(CONFIG_MPEGVIDEO)  += 
mips/mpegvideo_init_mips.o
 OBJS-$(CONFIG_MPEGVIDEOENC)   += mips/mpegvideoencdsp_init_mips.o
 OBJS-$(CONFIG_ME_CMP) += mips/me_cmp_init_mips.o
 OBJS-$(CONFIG_MPEG4_DECODER)  += mips/xvididct_init_mips.o
+OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_init_mips.o
 MSA-OBJS-$(CONFIG_HEVC_DECODER)   += mips/hevcdsp_msa.o\
  mips/hevc_mc_uni_msa.o\
  mips/hevc_mc_uniw_msa.o   \
@@ -79,3 +80,4 @@ MMI-OBJS-$(CONFIG_PIXBLOCKDSP)+= 
mips/pixblockdsp_mmi.o
 MMI-OBJS-$(CONFIG_H264QPEL)   += mips/h264qpel_mmi.o
 MMI-OBJS-$(CONFIG_VP8_DECODER)+= mips/vp8dsp_mmi.o
 MMI-OBJS-$(CONFIG_HPELDSP)+= mips/hpeldsp_mmi.o
+MMI-OBJS-$(CONFIG_WMV2DSP)+= mips/wmv2dsp_mmi.o
diff --git a/libavcodec/mips/wmv2dsp_init_mips.c 
b/libavcodec/mips/wmv2dsp_init_mips.c
new file mode 100644
index 000..51dd207
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_init_mips.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 Zhou Xiaoyong 
+ *
+ * This file is part of FFmpeg.
+ *
+ * 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.
+ *
+ * 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "libavutil/attributes.h"
+#include "wmv2dsp_mips.h"
+
+#if HAVE_MMI
+static av_cold void wmv2dsp_init_mmi(WMV2DSPContext *c)
+{
+c->idct_add  = ff_wmv2_idct_add_mmi;
+c->idct_put  = ff_wmv2_idct_put_mmi;
+}
+#endif /* HAVE_MMI */
+
+av_cold void ff_wmv2dsp_init_mips(WMV2DSPContext *c)
+{
+#if HAVE_MMI
+wmv2dsp_init_mmi(c);
+#endif /* HAVE_MMI */
+}
diff --git a/libavcodec/mips/wmv2dsp_mips.h b/libavcodec/mips/wmv2dsp_mips.h
new file mode 100644
index 000..22894c5
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_mips.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2016 Zhou Xiaoyong 
+ *
+ * This file is part of FFmpeg.
+ *
+ * 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.
+ *
+ * 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 FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_MIPS_WMV2DSP_MIPS_H
+#define AVCODEC_MIPS_WMV2DSP_MIPS_H
+
+#include "libavcodec/wmv2dsp.h"
+
+void ff_wmv2_idct_add_mmi(uint8_t *dest, int line_size, int16_t *block);
+void ff_wmv2_idct_put_mmi(uint8_t *dest, int line_size, int16_t *block);
+
+#endif /* AVCODEC_MIPS_WMV2DSP_MIPS_H */
diff --git a/libavcodec/mips/wmv2dsp_mmi.c b/libavcodec/mips/wmv2dsp_mmi.c
new file mode 100644
index 000..1f6ccb2
--- /dev/null
+++ b/libavcodec/mips/wmv2dsp_mmi.c
@@ -0,0 +1,278 @@
+/*
+ * WMV2 - DSP functions Loongson MMI-optimized
+ *
+ * Copyright (c) 2016 Zhou Xiaoyong 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Les