diff mbox

[FFmpeg-devel] speedhq: fix behavior of single-field decoding

Message ID E1db23v-00087B-DH@pannekake.samfundet.no
State Superseded
Headers show

Commit Message

Steinar H. Gunderson July 28, 2017, 9:57 a.m. UTC
The height convention for decoding frames with only a single field made sense
for compatibility with legacy decoders, but doesn't really match the convention
used by NDI, which is the primary (only?) user. Thus, change it to simply
assuming that if the two fields overlap, the frame is meant to be a single
field and the frame height matches the field height.
---
 libavcodec/speedhq.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

Comments

Michael Niedermayer July 30, 2017, 2:38 a.m. UTC | #1
On Fri, Jul 28, 2017 at 11:57:24AM +0200, Steinar H. Gunderson wrote:
> The height convention for decoding frames with only a single field made sense
> for compatibility with legacy decoders, but doesn't really match the convention
> used by NDI, which is the primary (only?) user. Thus, change it to simply
> assuming that if the two fields overlap, the frame is meant to be a single
> field and the frame height matches the field height.
> ---
>  libavcodec/speedhq.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)

can you add a fate test for this ?

you also may want to add yourself to MAINTAINERs for speedhq.c
it seems you are the one primarly maintaining this code

thx

[...]
diff mbox

Patch

diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c
index 60efb0222b..eca45beb67 100644
--- a/libavcodec/speedhq.c
+++ b/libavcodec/speedhq.c
@@ -448,12 +448,15 @@  static int speedhq_decode_frame(AVCodecContext *avctx,
     frame->key_frame = 1;
 
     if (second_field_offset == 4) {
-        /*
-         * Overlapping first and second fields is used to signal
-         * encoding only a single field (the second field then comes
-         * as a separate, later frame).
-         */
-        frame->height >>= 1;
+	/*
+	 * Overlapping first and second fields is used to signal
+	 * encoding only a single field. In this case, "height"
+	 * is ambiguous; it could mean either the height of the
+	 * frame as a whole, or of the field. The former would make
+	 * more sense for compatibility with legacy decoders,
+	 * but this matches the convention used in NDI, which is
+	 * the primary user of this trick.
+	 */
         if ((ret = decode_speedhq_field(s, buf, buf_size, frame, 0, 4, buf_size, 1)) < 0)
             return ret;
     } else {