From patchwork Fri Jul 28 09:57:24 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: 4501 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.1.76 with SMTP id 73csp842575vsb; Fri, 28 Jul 2017 14:53:55 -0700 (PDT) X-Received: by 10.28.95.69 with SMTP id t66mr6675298wmb.74.1501278835823; Fri, 28 Jul 2017 14:53:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501278835; cv=none; d=google.com; s=arc-20160816; b=eAgZ6vfiDAU9b3MVvu2a9qaFV/TYSIlJjtM7ubWHsM64LGy20lhdCRkeCoFnAp+dxE 47gXAwSaADHljTelqgD1kn5yJU8egv/YWPXgtNfXhOY7WbPU9i0IPa7rZb1dhZRHQ3MN dLNoF541DXAtrHouqvmNfriQGBTPTUJBot4R5Ldr2eVXsbsbXZ77CJRXA/Dg/YmfHJgo p9FACx6DsiQHRerqpwBBXE3JPXbBrwwF+jdj2jyPYv5YmnmrR33qDZFWHWYXxGa0XS4W VXEobJ1SopbN/fIPU+608ygshYQbXJd862+DbeOKg01v/+HncFSFkjUih2VpRPhtpWAx hIMQ== 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=m2OdFGis0hDxJRzImkvD1tb7VDLJXcIyq2tl0TyUYI4=; b=glw1XBLsBQxMu/rgyjY5idfBJccorSnFz2mvOUuPB2vbJefM0pdk1EfQ/+DrRjaHoJ sfETdDqo02udekwP1zwfbx6TbUC1EAXB/1yq0N1rK8BWiTxVNwiGBGCWk3EPO8vOYDc0 YN+KZZFb8DkYHJ7LGiX9EKBCkXARQTBV50mLdhQUJFqi3Dv8SDG2Y9P6ZoFBFBJKINNu SPsqEnegge7fD89btCumkWrxQS7STfqDeIyoizXMb1OlDHJQ1jdtCk0itQrGT4yzstco dxJyVA7wHMFJOS5DiUK58S2q52KnmbRejN3I00FyUklXraa/Y7yPpmkln8LDMCshepxs Je7Q== 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 y98si18192080wrc.522.2017.07.28.14.53.55; Fri, 28 Jul 2017 14:53:55 -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 C5D7F689C54; Sat, 29 Jul 2017 00:53:51 +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 0FDE168077F for ; Fri, 28 Jul 2017 13:00:03 +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 <4fe9c5cd104042446025a96cc6a8aecfa580dca7@pannekake.samfundet.no>) id 1db23v-0002LL-Ic for ffmpeg-devel@ffmpeg.org; Fri, 28 Jul 2017 12:00:03 +0200 Received: from sesse by pannekake.samfundet.no with local (Exim 4.89) (envelope-from <4fe9c5cd104042446025a96cc6a8aecfa580dca7@pannekake.samfundet.no>) id 1db23v-00087B-DH for ffmpeg-devel@ffmpeg.org; Fri, 28 Jul 2017 12:00:03 +0200 From: "Steinar H. Gunderson" Date: Fri, 28 Jul 2017 11:57:24 +0200 To: ffmpeg-devel@ffmpeg.org Message-Id: X-Mailman-Approved-At: Sat, 29 Jul 2017 00:53:50 +0300 Subject: [FFmpeg-devel] [PATCH] 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 | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 {