ffmpeg: add setting of field_order flag
authorTim Nicholson <Tim.Nicholson@bbc.co.uk>
Fri, 2 Nov 2012 13:09:48 +0000 (13:09 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 22 Nov 2012 04:30:43 +0000 (05:30 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffmpeg.c
tests/ref/fate/vsynth1-prores
tests/ref/fate/vsynth1-prores_kostya
tests/ref/fate/vsynth1-qtrle
tests/ref/fate/vsynth1-qtrlegray
tests/ref/fate/vsynth1-svq1
tests/ref/fate/vsynth2-prores
tests/ref/fate/vsynth2-prores_kostya
tests/ref/fate/vsynth2-qtrle
tests/ref/fate/vsynth2-qtrlegray
tests/ref/fate/vsynth2-svq1

index 71a9bea..2c3dfa2 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -846,6 +846,10 @@ static void do_video_out(AVFormatContext *s,
            method. */
         enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
         enc->coded_frame->top_field_first  = in_picture->top_field_first;
+        if (enc->coded_frame->interlaced_frame)
+            enc->field_order = enc->coded_frame->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
+        else
+            enc->field_order = AV_FIELD_PROGRESSIVE;
         pkt.data   = (uint8_t *)in_picture;
         pkt.size   =  sizeof(AVPicture);
         pkt.pts    = av_rescale_q(in_picture->pts, enc->time_base, ost->st->time_base);
@@ -868,6 +872,14 @@ static void do_video_out(AVFormatContext *s,
                 big_picture.top_field_first = !!ost->top_field_first;
         }
 
+        if (big_picture.interlaced_frame) {
+            if (enc->codec->id == AV_CODEC_ID_MJPEG)
+                enc->field_order = big_picture.top_field_first ? AV_FIELD_TT:AV_FIELD_BB;
+            else
+                enc->field_order = big_picture.top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
+        } else
+            enc->field_order = AV_FIELD_PROGRESSIVE;
+
         big_picture.quality = ost->st->codec->global_quality;
         if (!enc->me_threshold)
             big_picture.pict_type = 0;
index d13bd30..16517ee 100644 (file)
@@ -1,4 +1,4 @@
-17a598a8cc6b899c79e3c69b9679e08d *tests/data/fate/vsynth1-prores.mov
-5022811 tests/data/fate/vsynth1-prores.mov
+6f7ce83099b35e5af0cf484f2e9f1f4f *tests/data/fate/vsynth1-prores.mov
+5022821 tests/data/fate/vsynth1-prores.mov
 a2e2d1d45341a94ff994d1d92629f778 *tests/data/fate/vsynth1-prores.out.rawvideo
 stddev:    2.47 PSNR: 40.27 MAXDIFF:   31 bytes:  7603200/  7603200
index aa28aa2..ab6ecff 100644 (file)
@@ -1,4 +1,4 @@
-504b53c891d5bd917d5cf5190c312a20 *tests/data/fate/vsynth1-prores_kostya.mov
-3858901 tests/data/fate/vsynth1-prores_kostya.mov
+36411e06db3f86ddedd6171a56784d6b *tests/data/fate/vsynth1-prores_kostya.mov
+3858911 tests/data/fate/vsynth1-prores_kostya.mov
 0a4153637d0cc0a88a8bcbf04cfaf8c6 *tests/data/fate/vsynth1-prores_kostya.out.rawvideo
 stddev:    3.17 PSNR: 38.09 MAXDIFF:   39 bytes:  7603200/  7603200
index 081707d..9bd79cc 100644 (file)
@@ -1,4 +1,4 @@
-f66efb8a1fd455ef31de540df9a81909 *tests/data/fate/vsynth1-qtrle.mov
-15263148 tests/data/fate/vsynth1-qtrle.mov
+4eaa59011403ce3e53f8abb5cf6d26e5 *tests/data/fate/vsynth1-qtrle.mov
+15263158 tests/data/fate/vsynth1-qtrle.mov
 93695a27c24a61105076ca7b1f010bbd *tests/data/fate/vsynth1-qtrle.out.rawvideo
 stddev:    3.42 PSNR: 37.44 MAXDIFF:   48 bytes:  7603200/  7603200
index 99ec831..425c11f 100644 (file)
@@ -1,4 +1,4 @@
-a9f365910ce1eb0ccbc05b68ca7cfafb *tests/data/fate/vsynth1-qtrlegray.mov
-5113284 tests/data/fate/vsynth1-qtrlegray.mov
+d010ff7be190f4cd053d79ee7f601ce2 *tests/data/fate/vsynth1-qtrlegray.mov
+5113294 tests/data/fate/vsynth1-qtrlegray.mov
 29def4aed035ed65d3a89f7d382fccbe *tests/data/fate/vsynth1-qtrlegray.out.rawvideo
 stddev:   25.95 PSNR: 19.85 MAXDIFF:  122 bytes:  7603200/  7603200
index 7468b36..6be76e1 100644 (file)
@@ -1,4 +1,4 @@
-f2930c19bd18eb03c1f984a72cdb67c8 *tests/data/fate/vsynth1-svq1.mov
-1334223 tests/data/fate/vsynth1-svq1.mov
+ea441979fa5bf694d1f6cee958d56560 *tests/data/fate/vsynth1-svq1.mov
+1334233 tests/data/fate/vsynth1-svq1.mov
 9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo
 stddev:    9.58 PSNR: 28.50 MAXDIFF:  210 bytes:  7603200/  7603200
index 089fc6c..b5c80e2 100644 (file)
@@ -1,4 +1,4 @@
-2fb771b09172b82d045772b60084c923 *tests/data/fate/vsynth2-prores.mov
-2844066 tests/data/fate/vsynth2-prores.mov
+a6351254cccdbc7147600951a798172a *tests/data/fate/vsynth2-prores.mov
+2844076 tests/data/fate/vsynth2-prores.mov
 b5844025c0f4c7c37db702c3213db232 *tests/data/fate/vsynth2-prores.out.rawvideo
 stddev:    1.31 PSNR: 45.77 MAXDIFF:   11 bytes:  7603200/  7603200
index 3566f1d..16b6078 100644 (file)
@@ -1,4 +1,4 @@
-fcfd0e077ed36d46719d34248c0d6281 *tests/data/fate/vsynth2-prores_kostya.mov
-3884586 tests/data/fate/vsynth2-prores_kostya.mov
+7de64c634620de738c98aa22e9df927d *tests/data/fate/vsynth2-prores_kostya.mov
+3884596 tests/data/fate/vsynth2-prores_kostya.mov
 ca2f6c1162635dedfa468c90f1fdc0ef *tests/data/fate/vsynth2-prores_kostya.out.rawvideo
 stddev:    0.92 PSNR: 48.77 MAXDIFF:   10 bytes:  7603200/  7603200
index b29b7cc..5f53608 100644 (file)
@@ -1,4 +1,4 @@
-7ff87d3858b742ef2d72a7dd12dea019 *tests/data/fate/vsynth2-qtrle.mov
-14798335 tests/data/fate/vsynth2-qtrle.mov
+f2aea57de225cccadb936bba4086a836 *tests/data/fate/vsynth2-qtrle.mov
+14798345 tests/data/fate/vsynth2-qtrle.mov
 98d0e2854731472c5bf13d8638502d0a *tests/data/fate/vsynth2-qtrle.out.rawvideo
 stddev:    1.26 PSNR: 46.10 MAXDIFF:   13 bytes:  7603200/  7603200
index 6fa35d1..4568391 100644 (file)
@@ -1,4 +1,4 @@
-4d4eac9e7258dde5fbafe931c4bdca59 *tests/data/fate/vsynth2-qtrlegray.mov
-5111273 tests/data/fate/vsynth2-qtrlegray.mov
+fa10a87e9cf648d635340b90e41d2d38 *tests/data/fate/vsynth2-qtrlegray.mov
+5111283 tests/data/fate/vsynth2-qtrlegray.mov
 f63b5ebdfdba750e547c25131b0a3fd1 *tests/data/fate/vsynth2-qtrlegray.out.rawvideo
 stddev:   19.42 PSNR: 22.36 MAXDIFF:   72 bytes:  7603200/  7603200
index ec9cf88..bdde55e 100644 (file)
@@ -1,4 +1,4 @@
-c0a8f7e727a521ff3c1f6f9bd163e63d *tests/data/fate/vsynth2-svq1.mov
-766691 tests/data/fate/vsynth2-svq1.mov
+11da7948184b3fee455f66cc5f6f8ca5 *tests/data/fate/vsynth2-svq1.mov
+766701 tests/data/fate/vsynth2-svq1.mov
 aa03471dac3f49455a33a2b19fda1098 *tests/data/fate/vsynth2-svq1.out.rawvideo
 stddev:    3.23 PSNR: 37.93 MAXDIFF:   61 bytes:  7603200/  7603200