From patchwork Thu Jul 9 16:17:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Fu, Linjie" X-Patchwork-Id: 20928 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:80ca:0:0:0:0:0 with SMTP id c10csp1521058ybm; Thu, 9 Jul 2020 09:25:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxv1+bY+LJlqsXodeGaBJZ3hlAXekqVMfrId4HWfJDgQh3VU8izwwZ3ZAEuC1a1bKxgV94w X-Received: by 2002:a1c:6a13:: with SMTP id f19mr883952wmc.106.1594311959838; Thu, 09 Jul 2020 09:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594311959; cv=none; d=google.com; s=arc-20160816; b=qtd7r8n7uEngpZ+icF94hMyavw/AmhlVq65oqcSv84FbGeqGon0unwsIi7yg4kVwof 6cmV/mpHY25mCU/aUEoiU7LDoEyG1g9JXQveZPO+X+xOwW+QkDzmRx2kBY2cWwxPYSW7 nuZhWnz9pfgDzwvdPyUYgw/KS98yBdQPpFrcf6IwjxdarSvIgyIhGmDHMFP1bBoeimsd Xh4stJNHvSPReFnLcnVPk8kSq9kUPlbaTgpS6aq2GQYWMCC4hQ+c2LF1HKeHxlJKdDEB GmM5PmKfmwnmFwtfzf1j0vdYWwaPLk4wG9hmCUDKApo0QrWNAe+6Vx5K++w93HNJWZDS nYQg== 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:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:ironport-sdr:ironport-sdr:delivered-to; bh=rT71Hlf6FAgJpGAhdgRSnUQbmjzmsAW781RXHLz0ZBM=; b=CPhLUJVINL8XWneSoXyvP1iyHA9DBeT+1kiJM6USoeNSyZr/M3N5t16LiBVzSx5tR9 6aSLesaGjdL2xv62Kk195YRvIGBTgmES6B7kCyYWSI6KmWyqlaZ4PcFkaRBD0KVKHNR7 HAoWh+R/sWfg3Ec0NFPunWMNVqzbYR4eSBkxgRuNpQb8Q9Fr3sHk80nxZWwl6YluvMzY OI5EjMubUrzcoOzxSEOWrJYBFRqGvX/G6m6aeZFwI5LFtgrDycnVYq95K0S4r0gWvnqi 2+geqjgJSzzUcr+8xHhm+SnbsmaiUZmZpC7XAIWzimfxHsXuRbnaoEB+yJAGZ9l+x7aT nWLw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id j25si2678008wre.264.2020.07.09.09.25.59; Thu, 09 Jul 2020 09:25:59 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id A645E68B32D; Thu, 9 Jul 2020 19:25:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 61F6D68B51C for ; Thu, 9 Jul 2020 19:24:57 +0300 (EEST) IronPort-SDR: 2P/ycAWxYYifd7OyposfTyRIWFcByeX7zT3yaFXDHxukjhfS6ex74mppN1rU/sFZ9BY60xzkFR YpOSEYmguXcg== X-IronPort-AV: E=McAfee;i="6000,8403,9677"; a="145529138" X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="145529138" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jul 2020 09:24:57 -0700 IronPort-SDR: 7B33rSwki6qYYT8UrCBJ+Cnf7AYQJA63m+0O+5w6jLQ5XhmBSILNy34qpjzK1i1RNII1ppQW35 DfZwqLjDNE7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,331,1589266800"; d="scan'208";a="483859435" Received: from icl-dev.sh.intel.com ([10.239.158.73]) by fmsmga006.fm.intel.com with ESMTP; 09 Jul 2020 09:24:56 -0700 From: Linjie Fu To: ffmpeg-devel@ffmpeg.org Date: Fri, 10 Jul 2020 00:17:38 +0800 Message-Id: <1594311460-10498-6-git-send-email-linjie.fu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1594311460-10498-1-git-send-email-linjie.fu@intel.com> References: <1594311460-10498-1-git-send-email-linjie.fu@intel.com> Subject: [FFmpeg-devel] [PATCH 5/7] lavc/hevcdec: Fix the parsing for use_integer_mv_flag 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 Cc: Linjie Fu , Linjie Fu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: O9HdHVrbu6x7 Content-Length: 2383 According to 7.3.6.1, use_integer_mv_flag should be parsed if motion_vector_resolution_control_idc equals to 2. Otherwise wrong parameters in the subsequent parsing procedures would be got. Signed-off-by: Linjie Fu --- libavcodec/hevcdec.c | 8 ++++++++ libavcodec/hevcdec.h | 1 + 2 files changed, 9 insertions(+) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index 8194f18..fc8a77d 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -788,6 +788,14 @@ static int hls_slice_header(HEVCContext *s) sh->max_num_merge_cand); return AVERROR_INVALIDDATA; } + + // Syntax in 7.3.6.1 + if (s->ps.sps->motion_vector_resolution_control_idc == 2) + sh->use_integer_mv_flag = get_bits1(gb); + else + // Inferred to be equal to motion_vector_resolution_control_idc if not present + sh->use_integer_mv_flag = s->ps.sps->motion_vector_resolution_control_idc; + } sh->slice_qp_delta = get_se_golomb(gb); diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index 6e22e04..1164af2 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -302,6 +302,7 @@ typedef struct SliceHeader { int tc_offset; ///< tc_offset_div2 * 2 unsigned int max_num_merge_cand; ///< 5 - 5_minus_max_num_merge_cand + uint8_t use_integer_mv_flag; unsigned *entry_point_offset; int * offset;