From patchwork Thu Aug 3 07:22:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Steinar H. Gunderson" X-Patchwork-Id: 4611 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp539698vsu; Thu, 3 Aug 2017 00:32:56 -0700 (PDT) X-Received: by 10.223.172.137 with SMTP id o9mr547443wrc.275.1501745576512; Thu, 03 Aug 2017 00:32:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501745576; cv=none; d=google.com; s=arc-20160816; b=VrQZrNw0b+LO8ymgpu6NEFC4HOPFORDSq0s6ctTxEOBH/C5M8w8T3/HLxb5dsJvy/Y ZSn2CpppmOaj4OZpzFRvFblBcwQQTpycUKiE6ma4pAZ2jxlBwqpQPUJgwnATZRKfpqiN zyeihAfucM11Uk+Ct/KBfQWq5VCggmEhgtF8c53rg3KWJ2ylFWzx+Busz3DKOHKz8L/e zcYKZHCMSnrFvjl9ia0/4DfhezPYX7Iey3arW5fVjGGgSnQkEGdDreg0DDLzzuRyq05u /kr/0Gbs6eTvJYZLqflxPDqScVeDClS1/v1T+g0+b2HJyQi3IHFJmuO8clM8baNWy2YV 1e1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:message-id:to:date:from:delivered-to :arc-authentication-results; bh=6Ys2fLY5O/fty7NMUHI6/wh3lvcVpH2dW61vq+vGvUk=; b=HxxrUmpmJww7Q8dFrwnrLg/s+sBV0Cmo/nQiWUkCkmAaVeSGHLkO73nHzmB3rJtAMh 8KZT7R1De9KNcPlCF9Z+ZSihBmwMv6DLtOclW8nHZc6qvWfTKpZwaQHmvKZj/tVaPf5Y 4XNs10mwfZhOiVW2YLZDe3NTEbtQxkrQHqtA1FkERc5TTn0dRY1JRaI2lpv3TWgiuKHJ WnBcqQwKfHuS7RLGX2nlgT4PQFzgrdX02SD19sJJo50Btjb5fJduxURwWNVK2c01Ebej +fmDE4lNZrhlPLLxFr+e6oY9kSkKl95APJjNCsBYstL6iAW0Uo6LKUb4uHpU82fTSb9s Bfzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m18si855218wmc.51.2017.08.03.00.32.55; Thu, 03 Aug 2017 00:32:56 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 644DD6808BE; Thu, 3 Aug 2017 10:32:49 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from cassarossa.samfundet.no (cassarossa.samfundet.no [193.35.52.29]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E26086806AF for ; Thu, 3 Aug 2017 10:32:42 +0300 (EEST) Received: from pannekake.samfundet.no ([2001:67c:29f4::50]) by cassarossa.samfundet.no with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1ddAce-00057T-Ve for ffmpeg-devel@ffmpeg.org; Thu, 03 Aug 2017 09:32:45 +0200 Received: from sesse by pannekake.samfundet.no with local (Exim 4.89) (envelope-from ) id 1ddAce-000845-Sh for ffmpeg-devel@ffmpeg.org; Thu, 03 Aug 2017 09:32:44 +0200 From: "Steinar H. Gunderson" Date: Thu, 3 Aug 2017 09:22:57 +0200 To: ffmpeg-devel@ffmpeg.org Message-Id: Subject: [FFmpeg-devel] [PATCH v5 1/3] speedhq: fix behavior of single-field decoding X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" 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 | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/libavcodec/speedhq.c b/libavcodec/speedhq.c index 60efb0222b..47b1e4dc7a 100644 --- a/libavcodec/speedhq.c +++ b/libavcodec/speedhq.c @@ -450,10 +450,13 @@ static int speedhq_decode_frame(AVCodecContext *avctx, 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). + * 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. */ - frame->height >>= 1; if ((ret = decode_speedhq_field(s, buf, buf_size, frame, 0, 4, buf_size, 1)) < 0) return ret; } else {