From patchwork Mon Aug 20 02:01:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 10030 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp1994709jap; Sun, 19 Aug 2018 19:02:38 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaVdHxTZ/iSNTNvuLMYWytlmWbtNynBHS3Rz0ifGGlVHZDf89Ga6ITFNPsEAmZ71InfORKV X-Received: by 2002:adf:db52:: with SMTP id f18-v6mr4125138wrj.212.1534730558113; Sun, 19 Aug 2018 19:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534730558; cv=none; d=google.com; s=arc-20160816; b=W/VRXqYIkx5IIYrfesu6Bx5iCxgeWP/VmZ9ciS4xJzYyvcaOmD+v3QQN1Rlb++t/RP zl8/OSjXaR2HLAdZL3IfTzK+sTnb0TlCMZKCCg+7cMgxAbbF80qU6UOWhxnj6gS/QwOP 68/XbidrxT8uFUbciHnStbFPq87q24/QSfzf42OP5h3/CuVfgo6KONEwqvjxmrRnf37T F1o1QW4GDD35QE7taFhwd2aP6Q2JY7CSDdWpmZbun9y5g2WZug4c0whth/sUFhrEX4rA UQuYLqWl77fE7bzDGhO1YBZXtpD4HNBXfgnwl/1qgMTKkHU39sl7FDUIIsSfSHdJPZhq pA0w== 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:feedback-id:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=QhW76F/zbQ6JbcO6DDuWSe5pOs0et42RAk/x8V+e2XQ=; b=WOGMzo+S7YYnq9wSnsobP2NhScibO0J53qXZuTxiADLkACMcDkPmR0wRo2m6cOFMZf uWGiLfQ88Lb3uyjDRE3xy5HstOqpYz3x2akVJlTA5vpJBt6TDD3q4EOZJ0Dx2INrkznA jG+TM/UsXcaaibBoJccFLwb7t0rZmSBY8YWuuVU5istJ0N/h9JVadUP4Ngj5AY4qhHQG TDkiRRU+yx3Fu0rhhmTPc8C6xq/lQgBo4mMUfO4XNKfqoVSl5KovC4eLrZYKBCaBLGc5 bkGvfEyHYhi8Z1q0zb42RoHbtF9Ov/ic6vWbop5jNVZzRd/70gu7Oa4+dqa1dmbZicuZ cM8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=WZaNhnuc; 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=foxmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id l191-v6si7644640wmd.224.2018.08.19.19.02.37; Sun, 19 Aug 2018 19:02:38 -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=@foxmail.com header.s=s201512 header.b=WZaNhnuc; 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=foxmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id AFE38689975; Mon, 20 Aug 2018 05:02:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgeu2.qq.com (smtpbgeu2.qq.com [18.194.254.142]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8E237688372 for ; Mon, 20 Aug 2018 05:02:02 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1534730532; bh=cvnK7pFGW0gPm+WxzcXLgoJNPiPXqGtVEfCtZQhHnqs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=WZaNhnuczhyZX/GKy5/NW/FLgVwZaDw3upKMW8a83Pixk2b/t4DBXZPvTvTKWLa/K 0QqbXdh2s97w2M1KqHQFVwXBZegquUqCbaZP6mZK9C8zvw8v+REuqy3PRAErefqDEa p9QVcqoQP4B3FViDLI6jIGlHPvs+7gr4lnwKjays= X-QQ-mid: esmtp7t1534730531tcb827sm6 Received: from localhost.localdomain (unknown [119.145.5.45]) by esmtp4.qq.com (ESMTP) with id ; Mon, 20 Aug 2018 10:02:01 +0800 (CST) X-QQ-SSF: A1000000000000F0F81006000000001 X-QQ-FEAT: 6z79oIFE3GHHgsfLNfsh7mkDvK6yvZamOjRVKBQhXDl2BHDU8iHvim7jjiUIb 53YRqTC3bgzMNOdWe09HVVF3zH3tNTqBxxFs59FVxVKgywfZKXi6XxjOTIdaVE/HG8X8t6m 6tKH/Woc1x3XTSOJn51ukD0AXNpPbz+eL88wkZVEI3TMWCXZoMLbKiwcX7ZjXF3aNlDFbLN qECrQ3tMtP1wcuqkswUtGrpM1dvi0qd3XShfX+VFV6YaQjVYm9XvOQFpj9IxifvT7mwAnFq TfNfAyHM+fRV53o+zW7QIUhKkZRaUpCub+jg== X-QQ-GoodBg: 0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 20 Aug 2018 10:01:57 +0800 Message-Id: <20180820020157.4388-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20180817213333.GJ19650@michaelspb> References: <20180817213333.GJ19650@michaelspb> X-QQ-SENDSIZE: 520 Feedback-ID: esmtp:foxmail.com:bgforeign:bgforeign1 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH] lavc/hevc_ps: fix crop info for monochrome 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: Zhao Zhili MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" The values of SubWidthC and SubHeightC are 1 in the ITU-T H.265. The current code use the value of 2. --- libavcodec/hevc_ps.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c index fbd9fbf..ae1d4ad 100644 --- a/libavcodec/hevc_ps.c +++ b/libavcodec/hevc_ps.c @@ -70,6 +70,14 @@ static const AVRational vui_sar[] = { { 2, 1 }, }; +static const uint8_t hevc_sub_width_c[] = { + 1, 2, 2, 1 +}; + +static const uint8_t hevc_sub_height_c[] = { + 1, 2, 1, 1 +}; + static void remove_pps(HEVCParamSets *s, int id) { if (s->pps_list[id] && s->pps == (const HEVCPPS*)s->pps_list[id]->data) @@ -628,8 +636,8 @@ static void decode_vui(GetBitContext *gb, AVCodecContext *avctx, vui->default_display_window_flag = get_bits1(gb); if (vui->default_display_window_flag) { - int vert_mult = 1 + (sps->chroma_format_idc < 2); - int horiz_mult = 1 + (sps->chroma_format_idc < 3); + uint8_t vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; + uint8_t horiz_mult = hevc_sub_width_c[sps->chroma_format_idc]; vui->def_disp_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; vui->def_disp_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; vui->def_disp_win.top_offset = get_ue_golomb_long(gb) * vert_mult; @@ -923,8 +931,8 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id, return ret; if (get_bits1(gb)) { // pic_conformance_flag - int vert_mult = 1 + (sps->chroma_format_idc < 2); - int horiz_mult = 1 + (sps->chroma_format_idc < 3); + uint8_t vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; + uint8_t horiz_mult = hevc_sub_width_c[sps->chroma_format_idc]; sps->pic_conf_win.left_offset = get_ue_golomb_long(gb) * horiz_mult; sps->pic_conf_win.right_offset = get_ue_golomb_long(gb) * horiz_mult; sps->pic_conf_win.top_offset = get_ue_golomb_long(gb) * vert_mult;