From patchwork Mon Aug 20 04:36:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Zhili X-Patchwork-Id: 10031 Delivered-To: ffmpegpatchwork@gmail.com Received: by 2002:a02:12c4:0:0:0:0:0 with SMTP id 65-v6csp2087737jap; Sun, 19 Aug 2018 21:37:09 -0700 (PDT) X-Google-Smtp-Source: AA+uWPwOY5O02PldP4jD/KSLd5khrwiIoW+mcp2QuUh+/GR117F0rhC3tHQVcC9QIygOWrY8zHw0 X-Received: by 2002:adf:f64c:: with SMTP id x12-v6mr27209106wrp.97.1534739829898; Sun, 19 Aug 2018 21:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534739829; cv=none; d=google.com; s=arc-20160816; b=kdPfxfl3V9EzbTn5h6PEjFPXYcBtL1dwgTl0cIuDrMfeaOXzAqQhRkyUtK4bTpTu+g qN9cvedPl8lskxuaw689o1MnM8BMJChKJ3VQ5TM5NYdbzg4Kl5Wm5HR1iLYygoZgSDj5 b6zr1+Cd+l/gRkrnYFPBp6f6qDT6kUp86vFXr8YcyVowiM+Kwqfnk9TOcKkPq5tD6HNq 6sqChBWomlBHiwVHZSfWfuqF7KVFEc2a/AhCP4HErC/fxXRjL6WKP9/SfnS1Z0jK+VZP F4CV+TUQDpQ6BhVoyNkH79jxQiXZX+V3NHZWPneaew+cMzxHOc43HMLjIZ00/r+UFlUK 6ksg== 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:message-id:date:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=mLPKcr0X3i7lBsm4j7FI6i6sBdV8Ww3JIW9xn3dxwFo=; b=J8QelU0F2knUVr0kuEwPxFIFgqpks4703sdMPRrI5IFq3I1L6P5zyMnpKhK6sU5GKi igqncRLsAVkZsxtiV9od3dC66ltOTtIvhNACH1LvePzHbMXtfFrK62Od6ATgVzjIbJhM rT3GvJPK+ygfL9O6Oys2YjtAja9RKotxjQJ8nyHgk2XxsqP8a56teXAVEZ7gqKO3NksW uFqz/GusbYc+Bo0hc/Pw/eh9JqrF23xIEMzXmbJOrJI5OiCPXhXudp8qliGDeOSZnTj0 kmPCw6TJ8cpd6mZc89y6MCnLr8dWsnKybcWXzpLCzEEnZJ36ugHBGvleMiB/A6/CXI7v /MwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@foxmail.com header.s=s201512 header.b=yLEc444E; 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 j9-v6si6511255wrm.417.2018.08.19.21.37.08; Sun, 19 Aug 2018 21:37:09 -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=yLEc444E; 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 60177689975; Mon, 20 Aug 2018 07:36:40 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbg65.qq.com (smtpbg65.qq.com [103.7.28.233]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2391F6883E8 for ; Mon, 20 Aug 2018 07:36:32 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1534739815; bh=WVBJHbMDZwOql86brVOD8Uovw5nBqZJcZRsWl1ao3fU=; h=From:To:Cc:Subject:Date:Message-Id; b=yLEc444ECnTJn/80UuujujNetuo8NstAI+vo/e7JjUf8DIfKmB23OD26n0gUkuupu pCq/h5NbDHHOqlZRZuBzK3kXkzUTzddt8hJczH4nLrhucZ7dSLCu3vHl1EE8FtDh/8 Ho6Y4qR7Ait+h9/Xa+pUvowh4L9LBtFKOrintjfs= X-QQ-mid: esmtp4t1534739813tfwnif6qw Received: from localhost.localdomain (unknown [119.145.5.45]) by esmtp4.qq.com (ESMTP) with id ; Mon, 20 Aug 2018 12:36:47 +0800 (CST) X-QQ-SSF: A1000000000000F0F81004000000001 X-QQ-FEAT: JrSq/kX7t986hFIs0OKqP+kUaMTM1OrDR6ztl7EAcuoxtOFMgXA4X6U5tjCZ8 4PTA+6+Q622Ad6gokP3b2jQrVKY4BQJ+qNconavTSklYVDFX8hdXPDi/W/uqamqxpQdDe63 Wrw4ydTEOjC3JjHu9nS/ntMCAmiKa0vpMHrw3Nnc1zAYA2PmaD6m22T1FVis2u1ADiiDqqJ co69sD29PMQM/8LD2gNIOcgGk7PDxhFM6n225ZAe2oWlxgaXYDR7fk7vGAHMAkZt0e+eCLC HEc6lTh0eBbK7zoAtOo3IBF/I= X-QQ-GoodBg: 0 From: Zhao Zhili To: ffmpeg-devel@ffmpeg.org Date: Mon, 20 Aug 2018 12:36:46 +0800 Message-Id: <20180820043646.8832-1-quinkblack@foxmail.com> X-Mailer: git-send-email 2.9.5 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..ea984af 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); + int vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; + int 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); + int vert_mult = hevc_sub_height_c[sps->chroma_format_idc]; + int 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;