Skip to content

Commit dcbf728

Browse files
nichot20michaelni
authored andcommitted
ffmpeg: add setting of field_order flag
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
1 parent 91743fb commit dcbf728

File tree

11 files changed

+32
-20
lines changed

11 files changed

+32
-20
lines changed

ffmpeg.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,6 +846,10 @@ static void do_video_out(AVFormatContext *s,
846846
method. */
847847
enc->coded_frame->interlaced_frame = in_picture->interlaced_frame;
848848
enc->coded_frame->top_field_first = in_picture->top_field_first;
849+
if (enc->coded_frame->interlaced_frame)
850+
enc->field_order = enc->coded_frame->top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
851+
else
852+
enc->field_order = AV_FIELD_PROGRESSIVE;
849853
pkt.data = (uint8_t *)in_picture;
850854
pkt.size = sizeof(AVPicture);
851855
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,
868872
big_picture.top_field_first = !!ost->top_field_first;
869873
}
870874

875+
if (big_picture.interlaced_frame) {
876+
if (enc->codec->id == AV_CODEC_ID_MJPEG)
877+
enc->field_order = big_picture.top_field_first ? AV_FIELD_TT:AV_FIELD_BB;
878+
else
879+
enc->field_order = big_picture.top_field_first ? AV_FIELD_TB:AV_FIELD_BT;
880+
} else
881+
enc->field_order = AV_FIELD_PROGRESSIVE;
882+
871883
big_picture.quality = ost->st->codec->global_quality;
872884
if (!enc->me_threshold)
873885
big_picture.pict_type = 0;

tests/ref/fate/vsynth1-prores

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
17a598a8cc6b899c79e3c69b9679e08d *tests/data/fate/vsynth1-prores.mov
2-
5022811 tests/data/fate/vsynth1-prores.mov
1+
6f7ce83099b35e5af0cf484f2e9f1f4f *tests/data/fate/vsynth1-prores.mov
2+
5022821 tests/data/fate/vsynth1-prores.mov
33
a2e2d1d45341a94ff994d1d92629f778 *tests/data/fate/vsynth1-prores.out.rawvideo
44
stddev: 2.47 PSNR: 40.27 MAXDIFF: 31 bytes: 7603200/ 7603200
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
504b53c891d5bd917d5cf5190c312a20 *tests/data/fate/vsynth1-prores_kostya.mov
2-
3858901 tests/data/fate/vsynth1-prores_kostya.mov
1+
36411e06db3f86ddedd6171a56784d6b *tests/data/fate/vsynth1-prores_kostya.mov
2+
3858911 tests/data/fate/vsynth1-prores_kostya.mov
33
0a4153637d0cc0a88a8bcbf04cfaf8c6 *tests/data/fate/vsynth1-prores_kostya.out.rawvideo
44
stddev: 3.17 PSNR: 38.09 MAXDIFF: 39 bytes: 7603200/ 7603200

tests/ref/fate/vsynth1-qtrle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
f66efb8a1fd455ef31de540df9a81909 *tests/data/fate/vsynth1-qtrle.mov
2-
15263148 tests/data/fate/vsynth1-qtrle.mov
1+
4eaa59011403ce3e53f8abb5cf6d26e5 *tests/data/fate/vsynth1-qtrle.mov
2+
15263158 tests/data/fate/vsynth1-qtrle.mov
33
93695a27c24a61105076ca7b1f010bbd *tests/data/fate/vsynth1-qtrle.out.rawvideo
44
stddev: 3.42 PSNR: 37.44 MAXDIFF: 48 bytes: 7603200/ 7603200

tests/ref/fate/vsynth1-qtrlegray

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
a9f365910ce1eb0ccbc05b68ca7cfafb *tests/data/fate/vsynth1-qtrlegray.mov
2-
5113284 tests/data/fate/vsynth1-qtrlegray.mov
1+
d010ff7be190f4cd053d79ee7f601ce2 *tests/data/fate/vsynth1-qtrlegray.mov
2+
5113294 tests/data/fate/vsynth1-qtrlegray.mov
33
29def4aed035ed65d3a89f7d382fccbe *tests/data/fate/vsynth1-qtrlegray.out.rawvideo
44
stddev: 25.95 PSNR: 19.85 MAXDIFF: 122 bytes: 7603200/ 7603200

tests/ref/fate/vsynth1-svq1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
f2930c19bd18eb03c1f984a72cdb67c8 *tests/data/fate/vsynth1-svq1.mov
2-
1334223 tests/data/fate/vsynth1-svq1.mov
1+
ea441979fa5bf694d1f6cee958d56560 *tests/data/fate/vsynth1-svq1.mov
2+
1334233 tests/data/fate/vsynth1-svq1.mov
33
9cc35c54b2c77d36bd7e308b393c1f81 *tests/data/fate/vsynth1-svq1.out.rawvideo
44
stddev: 9.58 PSNR: 28.50 MAXDIFF: 210 bytes: 7603200/ 7603200

tests/ref/fate/vsynth2-prores

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
2fb771b09172b82d045772b60084c923 *tests/data/fate/vsynth2-prores.mov
2-
2844066 tests/data/fate/vsynth2-prores.mov
1+
a6351254cccdbc7147600951a798172a *tests/data/fate/vsynth2-prores.mov
2+
2844076 tests/data/fate/vsynth2-prores.mov
33
b5844025c0f4c7c37db702c3213db232 *tests/data/fate/vsynth2-prores.out.rawvideo
44
stddev: 1.31 PSNR: 45.77 MAXDIFF: 11 bytes: 7603200/ 7603200
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
fcfd0e077ed36d46719d34248c0d6281 *tests/data/fate/vsynth2-prores_kostya.mov
2-
3884586 tests/data/fate/vsynth2-prores_kostya.mov
1+
7de64c634620de738c98aa22e9df927d *tests/data/fate/vsynth2-prores_kostya.mov
2+
3884596 tests/data/fate/vsynth2-prores_kostya.mov
33
ca2f6c1162635dedfa468c90f1fdc0ef *tests/data/fate/vsynth2-prores_kostya.out.rawvideo
44
stddev: 0.92 PSNR: 48.77 MAXDIFF: 10 bytes: 7603200/ 7603200

tests/ref/fate/vsynth2-qtrle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
7ff87d3858b742ef2d72a7dd12dea019 *tests/data/fate/vsynth2-qtrle.mov
2-
14798335 tests/data/fate/vsynth2-qtrle.mov
1+
f2aea57de225cccadb936bba4086a836 *tests/data/fate/vsynth2-qtrle.mov
2+
14798345 tests/data/fate/vsynth2-qtrle.mov
33
98d0e2854731472c5bf13d8638502d0a *tests/data/fate/vsynth2-qtrle.out.rawvideo
44
stddev: 1.26 PSNR: 46.10 MAXDIFF: 13 bytes: 7603200/ 7603200

tests/ref/fate/vsynth2-qtrlegray

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
4d4eac9e7258dde5fbafe931c4bdca59 *tests/data/fate/vsynth2-qtrlegray.mov
2-
5111273 tests/data/fate/vsynth2-qtrlegray.mov
1+
fa10a87e9cf648d635340b90e41d2d38 *tests/data/fate/vsynth2-qtrlegray.mov
2+
5111283 tests/data/fate/vsynth2-qtrlegray.mov
33
f63b5ebdfdba750e547c25131b0a3fd1 *tests/data/fate/vsynth2-qtrlegray.out.rawvideo
44
stddev: 19.42 PSNR: 22.36 MAXDIFF: 72 bytes: 7603200/ 7603200

0 commit comments

Comments
 (0)