From patchwork Fri May 18 15:06:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jerome Borsboom X-Patchwork-Id: 9013 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:155:0:0:0:0:0 with SMTP id c82-v6csp5415303jad; Fri, 18 May 2018 08:06:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxDjkmoPGsBYuT4/OKcdh+3UVoCf4RqebAUSYcdre7G946PRyUypd0PE+U8DEQAywliiq1 X-Received: by 2002:adf:9ae5:: with SMTP id a92-v6mr7717237wrc.180.1526656011731; Fri, 18 May 2018 08:06:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526656011; cv=none; d=google.com; s=arc-20160816; b=y31ZGL34We9qr0zlxOx/JLr3dVXO9zsxHK8xqDt4K/JRaop41aPUb77nqecQYoVU7H 5pl0PbJXTh9EIhBL5MJehfPYTY2Q1/jZ/3peLVnLm/CKtq5pE/SR6sMkUIuwipw0oMD/ 1rsSFmbXXJkTMxn5neaF32OfzIrqy4+vEXis52DAUzembTC5W2jlRF06DbLIBoKACHUI srjw2LPVpJ61nrBptWQTwmg+eEuKy8dCoB8I2y780LJQUHcDwBdvrIoySMhapcuoc7oT 0o/nGeHHDyUjxeH+x5u6gVlEFB6Bk8z+xc3ebKGmN0z5Lnto35D9AERD1cxZv1LmbBqr 2/vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:content-language:mime-version:user-agent:date :message-id:from:to:dkim-signature:delivered-to :arc-authentication-results; bh=0p6x43OIw6ZBUZkH4YisNW2UYvQPeOLhw+LEtr5Qpno=; b=LEXGvQqmMs+2T7Sdjy0RT42BdYjRRi0jo0Mjj8qMse7GM1uDxsm+xVBQip3gnRM/yc uMDPgu2P5mMwMOyNe1z0DwQmo54FxFwm1Ink2sFLr63iHXiO1zKCgtoI8XgHhSk4BLil O67WEYJJEdEizN1R1026p580upeUGkR/NQmF3PYT+8yljbmBY5gqlSAVAinR2JP4RKrk bifceHJgQkxnOJZM9NhBPmus0bunjQLNospeQAL2nTbKp68zJt8bwW+S59jZ2xyjODVf ymbhxXmfpU5f2C+wpBLByzSmOdQ5GPRjjtkhho7UCBkpB+FRwC4Qq9Xsb2Ht6zRY+hhc V06w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@carpalis.nl header.s=default header.b=guTdfPWC; 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 o6-v6si6697123wrm.206.2018.05.18.08.06.51; Fri, 18 May 2018 08:06:51 -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; dkim=neutral (body hash did not verify) header.i=@carpalis.nl header.s=default header.b=guTdfPWC; 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 193E868A3A9; Fri, 18 May 2018 18:05:57 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from kyoto.xs4all.nl (kyoto.xs4all.nl [83.161.153.34]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E086C689DE7 for ; Fri, 18 May 2018 18:05:49 +0300 (EEST) Received: from [192.168.2.133] ([192.168.2.133]) (authenticated bits=0) by kyoto.xs4all.nl (8.14.7/8.14.7) with ESMTP id w4IF6SH8009637 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Fri, 18 May 2018 17:06:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=carpalis.nl; s=default; t=1526655988; bh=EpsrKmQa6Mgn/lqy7O7DNUQ9FpC+o2uds6iWmumBAPU=; h=To:From:Subject:Date; b=guTdfPWCPbVcw6Yg0O6mzZYMaTrV5vkXA8VL8vb8Cokp1ZrOra5ui3i213t4hJAIj 9bCt3FAnPaOkrh0QHeqq0p++1ZC7FgWNjiFe8LKP1tOJ2VQ4pAfibQ5g2cT8x9ZivW ac6zQK4bEP4pcWeXN/O30cfwoL0Ol1o19BsLrUwOZYvl+wZX7sU9YmXFXDn0qQ+HU7 DIG3fiK4edFTYRybRmBV9W0nL1BdspIJXczdPPNdIhv7iBwsuLfDL28yUgi82eHI0f DwOCupPR//D7g1FiTw2yrzVxZPYLIYgsKoEs1iOCrkTYH5Llqp8urt6J5vkffl2FB2 4vIDcBLfuPvvg== To: ffmpeg-devel@ffmpeg.org From: Jerome Borsboom Message-ID: <63aa5524-781d-cfd0-94ab-f8c1e68b9475@carpalis.nl> Date: Fri, 18 May 2018 17:06:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 Content-Language: nl Subject: [FFmpeg-devel] [PATCH 3/5] avcodec/vc1: DIRECTBIT is only present in inter MBs 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" DIRECTBIT was decoded before the intra/inter MB branching when decoding interlace frame B pictures. Resulting in mistakenly also decoding it for intra MBs where this syntax element is not present. Signed-off-by: Jerome Borsboom --- libavcodec/vc1_block.c | 71 +++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 35 deletions(-) diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c index aa2ea5024e..74935ec9e9 100644 --- a/libavcodec/vc1_block.c +++ b/libavcodec/vc1_block.c @@ -2173,41 +2173,6 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) } } - if (v->dmb_is_raw) - direct = get_bits1(gb); - else - direct = v->direct_mb_plane[mb_pos]; - - if (direct) { - if (s->next_picture_ptr->field_picture) - av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); - s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); - - if (twomv) { - s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); - s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); - s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); - s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); - - for (i = 1; i < 4; i += 2) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; - s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; - s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; - } - } else { - for (i = 1; i < 4; i++) { - s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; - s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; - s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; - s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; - } - } - } - if (ff_vc1_mbmode_intfrp[0][idx_mbmode][0] == MV_PMODE_INTFR_INTRA) { // intra MB for (i = 0; i < 4; i++) { s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = 0; @@ -2258,6 +2223,42 @@ static int vc1_decode_b_mb_intfr(VC1Context *v) } } else { s->mb_intra = v->is_intra[s->mb_x] = 0; + + if (v->dmb_is_raw) + direct = get_bits1(gb); + else + direct = v->direct_mb_plane[mb_pos]; + + if (direct) { + if (s->next_picture_ptr->field_picture) + av_log(s->avctx, AV_LOG_WARNING, "Mixed frame/field direct mode not supported\n"); + s->mv[0][0][0] = s->current_picture.motion_val[0][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][0][1] = s->current_picture.motion_val[0][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][0][0] = s->current_picture.motion_val[1][s->block_index[0]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][0][1] = s->current_picture.motion_val[1][s->block_index[0]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[0]][1], v->bfraction, 1, s->quarter_sample); + + if (twomv) { + s->mv[0][2][0] = s->current_picture.motion_val[0][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 0, s->quarter_sample); + s->mv[0][2][1] = s->current_picture.motion_val[0][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 0, s->quarter_sample); + s->mv[1][2][0] = s->current_picture.motion_val[1][s->block_index[2]][0] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][0], v->bfraction, 1, s->quarter_sample); + s->mv[1][2][1] = s->current_picture.motion_val[1][s->block_index[2]][1] = scale_mv(s->next_picture.motion_val[1][s->block_index[2]][1], v->bfraction, 1, s->quarter_sample); + + for (i = 1; i < 4; i += 2) { + s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][i-1][0]; + s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][i-1][1]; + s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][i-1][0]; + s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][i-1][1]; + } + } else { + for (i = 1; i < 4; i++) { + s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0] = s->mv[0][0][0]; + s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1] = s->mv[0][0][1]; + s->mv[1][i][0] = s->current_picture.motion_val[1][s->block_index[i]][0] = s->mv[1][0][0]; + s->mv[1][i][1] = s->current_picture.motion_val[1][s->block_index[i]][1] = s->mv[1][0][1]; + } + } + } + if (!direct) { if (skipped || !s->mb_intra) { bmvtype = decode012(gb);