From patchwork Wed Aug 2 16:08:28 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: 4602 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.46.211 with SMTP id u202csp1392767vsu; Wed, 2 Aug 2017 09:10:16 -0700 (PDT) X-Received: by 10.223.158.205 with SMTP id b13mr16507728wrf.131.1501690216151; Wed, 02 Aug 2017 09:10:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501690216; cv=none; d=google.com; s=arc-20160816; b=gJPHykCmBrh1qEHPpgUht+HXZUZOyijkP5fSaYmfNeNyVd0G87FViwTFbDjp4WDq9j ZkAHFK/6MpJcUQl/4LgXN4vVMWxLXwsgoRXoNGtExp6j5rFwyXT7uozMG7o/4LFwA7ma GjdXN/g2fcm0EDuTBl8E0MWDNQuwkaaQx/2Bqz/VWKxer+I9IJ9O9/ltNtaV0XhWSJCx 1JaY9NczEZ4SUQkDJhs4GcLg4kzLIEyQzexB5uJuaeYAJnNa2K2gBkqD80VE59mE50V4 vStASoqkfU8PPiZUuIo8fw11+ZA6wVqpgBeOrMVC4gtm3+tcCT2vOna22k28ncapcFDz aXtQ== 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=yYg8l04bbYbYcagOMvTar7GuYNcfuei1FiVM534ybrI=; b=ksJWJcBXWan5Co1aEaE/DKfQwkSz+8+y4R/CvuSBFhYOZvynhtc2Eqt9rki0gxNV9j 3+wQipeFbcVzKa3aKWmKItFBaMDNGfwzLAZnBqbQbU84LuO+TbK6fMtnlViN+8U6GOTI 6bWUp9j3p4J2n5I/JuMmUyjyLye3QRZIY+wP+wDda52/7D4NnAdwIjznmAg7u/sWdmCm zPx/2VzfbIzM7YojROsUNnc0TOByZ+fBbeGZAX07CGFxMpOff7WzYUt0fLSgQllC2Jsp TLFkvirAouRak5rBcodE4CzWH8wyJA3arIBgJaKbP2xq3NAWQm5qk1y3C7ruY+P+3+KM K8hQ== 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 30si21773618wrk.59.2017.08.02.09.10.15; Wed, 02 Aug 2017 09:10:16 -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 C3E3568A287; Wed, 2 Aug 2017 19:10:09 +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 25227689E8E for ; Wed, 2 Aug 2017 19:10: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 <2d53ed4caf0b33fa33b1d586c2dd3f9ee280f396@pannekake.samfundet.no>) id 1dcwDk-0007S7-HG for ffmpeg-devel@ffmpeg.org; Wed, 02 Aug 2017 18:10:05 +0200 Received: from sesse by pannekake.samfundet.no with local (Exim 4.89) (envelope-from <2d53ed4caf0b33fa33b1d586c2dd3f9ee280f396@pannekake.samfundet.no>) id 1dcwDk-0009o0-BO for ffmpeg-devel@ffmpeg.org; Wed, 02 Aug 2017 18:10:04 +0200 From: "Steinar H. Gunderson" Date: Wed, 2 Aug 2017 18:08:28 +0200 To: ffmpeg-devel@ffmpeg.org Message-Id: Subject: [FFmpeg-devel] [PATCH v4 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. Also add simple FATE tests, based on output produced by the NDI SDK. --- 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 {