[FFmpeg-cvslog] avformat/avienc: Use avi_write_packet_internal() to store raw rgb in a more spec compliant way

Michael Niedermayer git at videolan.org
Thu Feb 18 21:33:32 CET 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Feb 17 13:37:41 2016 +0100| [9dd4dcde9cdeba21b4bf40fc664c1277bbe27110] | committer: Michael Niedermayer

avformat/avienc: Use avi_write_packet_internal() to store raw rgb in a more spec compliant way

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/Makefile          |    2 +-
 libavformat/avienc.c          |   14 ++++++++++++++
 libavformat/version.h         |    2 +-
 tests/ref/vsynth/vsynth3-bpp1 |    4 ++--
 tests/ref/vsynth/vsynth3-rgb  |    4 ++--
 5 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/libavformat/Makefile b/libavformat/Makefile
index 35a383d..001b3f1 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -98,7 +98,7 @@ OBJS-$(CONFIG_AST_MUXER)                 += ast.o astenc.o
 OBJS-$(CONFIG_AU_DEMUXER)                += au.o pcm.o
 OBJS-$(CONFIG_AU_MUXER)                  += au.o rawenc.o
 OBJS-$(CONFIG_AVI_DEMUXER)               += avidec.o isom.o
-OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o mpegtsenc.o avlanguage.o
+OBJS-$(CONFIG_AVI_MUXER)                 += avienc.o mpegtsenc.o avlanguage.o rawutils.o
 OBJS-$(CONFIG_AVISYNTH)                  += avisynth.o
 OBJS-$(CONFIG_AVM2_MUXER)                += swfenc.o swf.o
 OBJS-$(CONFIG_AVR_DEMUXER)               += avr.o pcm.o
diff --git a/libavformat/avienc.c b/libavformat/avienc.c
index 2d3d51f..09ec63b 100644
--- a/libavformat/avienc.c
+++ b/libavformat/avienc.c
@@ -659,6 +659,20 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt)
     if ((ret = write_skip_frames(s, stream_index, pkt->dts)) < 0)
         return ret;
 
+    if (enc->codec_id == AV_CODEC_ID_RAWVIDEO && enc->codec_tag == 0) {
+        int64_t bpc = enc->bits_per_coded_sample != 15 ? enc->bits_per_coded_sample : 16;
+        int expected_stride = ((enc->width * bpc + 31) >> 5)*4;
+
+        ret = ff_reshuffle_raw_rgb(s, &pkt, enc, expected_stride);
+        if (ret < 0)
+            return ret;
+        if (ret) {
+            ret = avi_write_packet_internal(s, pkt);
+            av_packet_free(&pkt);
+            return ret;
+        }
+    }
+
     return avi_write_packet_internal(s, pkt);
 }
 
diff --git a/libavformat/version.h b/libavformat/version.h
index 024ab91..62050a2 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -31,7 +31,7 @@
 
 #define LIBAVFORMAT_VERSION_MAJOR  57
 #define LIBAVFORMAT_VERSION_MINOR  25
-#define LIBAVFORMAT_VERSION_MICRO 100
+#define LIBAVFORMAT_VERSION_MICRO 101
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
                                                LIBAVFORMAT_VERSION_MINOR, \
diff --git a/tests/ref/vsynth/vsynth3-bpp1 b/tests/ref/vsynth/vsynth3-bpp1
index 5a65728..39f27f3 100644
--- a/tests/ref/vsynth/vsynth3-bpp1
+++ b/tests/ref/vsynth/vsynth3-bpp1
@@ -1,4 +1,4 @@
-98852649c5201df7d85d0e9b5a5b9f15 *tests/data/fate/vsynth3-bpp1.avi
-15352 tests/data/fate/vsynth3-bpp1.avi
+d5689d1f5c2d4c28a345d5964a6161a8 *tests/data/fate/vsynth3-bpp1.avi
+20452 tests/data/fate/vsynth3-bpp1.avi
 0b1ea21b69d384564dd3a978065443b2 *tests/data/fate/vsynth3-bpp1.out.rawvideo
 stddev:   97.64 PSNR:  8.34 MAXDIFF:  248 bytes:    86700/    86700
diff --git a/tests/ref/vsynth/vsynth3-rgb b/tests/ref/vsynth/vsynth3-rgb
index c0a8563..f67d285 100644
--- a/tests/ref/vsynth/vsynth3-rgb
+++ b/tests/ref/vsynth/vsynth3-rgb
@@ -1,4 +1,4 @@
-a2cb86007b8945e2d1399b56585b983a *tests/data/fate/vsynth3-rgb.avi
-180252 tests/data/fate/vsynth3-rgb.avi
+000bd5f3251bfd6a2a2b590b2d16fe0b *tests/data/fate/vsynth3-rgb.avi
+183652 tests/data/fate/vsynth3-rgb.avi
 693aff10c094f8bd31693f74cf79d2b2 *tests/data/fate/vsynth3-rgb.out.rawvideo
 stddev:    3.67 PSNR: 36.82 MAXDIFF:   43 bytes:    86700/    86700



More information about the ffmpeg-cvslog mailing list