[FFmpeg-devel] [PATCH 1/2] avcodec/vc2enc: do not write an End Sequence after the first field of field-separated pictures

James Darnley jdarnley at obe.tv
Fri Feb 23 19:33:44 EET 2018


A lax or tolerant decoder may support an End Sequence between fields of the same
frame but the spec. says this is not allowed.

2012 spec. 10.3.2, 2017 spec. 10.4.3:
Where pictures are fields, a sequence shall comprise a whole number of
frames (i.e., an even number of fields) and shall begin and end with a
whole frame/field-pair.
---
 libavcodec/vc2enc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavcodec/vc2enc.c b/libavcodec/vc2enc.c
index b7adcd3d36..9a5a4765c8 100644
--- a/libavcodec/vc2enc.c
+++ b/libavcodec/vc2enc.c
@@ -988,7 +988,13 @@ static int encode_frame(VC2EncContext *s, AVPacket *avpkt, const AVFrame *frame,
     encode_slices(s);
 
     /* End sequence */
-    encode_parse_info(s, DIRAC_PCODE_END_SEQ);
+    /* 2012 spec. 10.3.2, 2017 spec. 10.4.3:
+     * Where pictures are fields, a sequence shall comprise a whole number of
+     * frames (i.e., an even number of fields) and shall begin and end with a
+     * whole frame/field-pair. */
+    if (field != 1) {
+        encode_parse_info(s, DIRAC_PCODE_END_SEQ);
+    }
 
     return 0;
 }
-- 
2.16.1



More information about the ffmpeg-devel mailing list