From patchwork Thu Dec 7 19:56:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sfan5 X-Patchwork-Id: 6589 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.161.94 with SMTP id m30csp8713825jah; Thu, 7 Dec 2017 11:56:21 -0800 (PST) X-Google-Smtp-Source: AGs4zMbb28I3DVfuoe9Ckf6xqNgl/L+X4Q4tj4IPkgAdzXLX1YdM2nyGHP3nVB5FZFrQOt/5SqKv X-Received: by 10.223.141.180 with SMTP id o49mr25963646wrb.35.1512676581177; Thu, 07 Dec 2017 11:56:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512676581; cv=none; d=google.com; s=arc-20160816; b=CSvAlxP9M4UgkdpiPeLUtIHVIp5aDE2kcqAnR7h5rTNIMDZDFrzuD6BJfPc2krR9ux oXdFKyikWURmqs+tlmXsV08RFacAJoZ+pQo8Jpenh9lbK19E75LeE3aBeIYTSD90H2yc QFKIQREh/qHScSpleOANvGc3QTEVf17fzNpVyH3KYs77ndhG61nk7j5KPLuP25nwfmlZ foXlmYzRC4p/tcOfZY9KvxFSDAPxLOEBrno7fTnWoXyiXGhaKzdtJ9gAQGVIMkKt9C6s hGHnkOejdw8uOE6uZ5yzSFAdNnllMKIF9poh3CM4cZPnHjnntwiLUhsbX42vAffNn8bN S12w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:spamdiagnosticmetadata:spamdiagnosticoutput :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:to:from:delivered-to :arc-authentication-results; bh=OuAO23gyNUACSyV1b6gKx30yqBgSp1/kgjpH5ShubXs=; b=qAW/FUkshSmwGluza9uGhlqaBqoT82ZZvOwcY43r7TUEn1tDudY1oa01rAx2Acp86s d8cLmoSBKctA4ssNNVeUjKjDdfP74i8zK9do1Ve2chlPgJZHEDxRTKHbafrNJ0sBisan nn76E0vCAocoTnfAFuxiLaBKoy8ou6d5DDuhbICAJniQv2sVd6myi31qFpjlozPkmplj 514xriRwWPuxNcdhlKwY7sAyx5lL7woMpyqLsr6QUth55AFmQa0GHVfuEXil+YoS4+mJ WHZrFjiIxbZBy2ov+raum2dKhCjgxLzsL/PNsSIWC2wJrLeH8uINyMajiklLyQljaNxB nVoQ== 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 58si4474556wrt.460.2017.12.07.11.56.20; Thu, 07 Dec 2017 11:56:21 -0800 (PST) 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 5140068A34C; Thu, 7 Dec 2017 21:56:13 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-oln040092071011.outbound.protection.outlook.com [40.92.71.11]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DBD4868A34C for ; Thu, 7 Dec 2017 21:56:06 +0200 (EET) Received: from AM5EUR03FT013.eop-EUR03.prod.protection.outlook.com (10.152.16.52) by AM5EUR03HT033.eop-EUR03.prod.protection.outlook.com (10.152.17.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.282.5; Thu, 7 Dec 2017 19:56:11 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com (10.152.16.55) by AM5EUR03FT013.mail.protection.outlook.com (10.152.16.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.20.282.5 via Frontend Transport; Thu, 7 Dec 2017 19:56:11 +0000 Received: from DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f8c4:4dc5:8552:d274]) by DB3PR0202MB3452.eurprd02.prod.outlook.com ([fe80::f8c4:4dc5:8552:d274%13]) with mapi id 15.20.0260.007; Thu, 7 Dec 2017 19:56:11 +0000 From: Stefan _ To: "ffmpeg-devel@ffmpeg.org" Thread-Topic: [PATCH v3 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function Thread-Index: AQHTb5Vuh/Aknm8+ck6xV/SgTcAQkA== Date: Thu, 7 Dec 2017 19:56:11 +0000 Message-ID: References: <20171206173207.GP4636@nb4> <20171207164149.GR4636@nb4> In-Reply-To: <20171207164149.GR4636@nb4> Accept-Language: de-DE, en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:B43C3554BDDB4F1B4E140588283CA9A1AF55F413990D3787F0B922E0C7D6C974; UpperCasedChecksum:CCABE2D4BDB1D4264ECE28A5D8D1BC4D287CD811B5845D6CB5B11BB7BF41CD18; SizeAsReceived:7432; Count:46 x-ms-exchange-messagesentrepresentingtype: 1 x-tmn: [W1UFYVTgpFrutgBamhgxwmaUrM3kmAur] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; AM5EUR03HT033; 6:hLVFlq9otP18PHnMFVcFSOcwYAbhCQACiFVJpPgNTdEB526fEqBmQlfcUVKrr6V39ZzR0jHsU4fXaJrNEIQkDYfi0WjwiBP1otaUxqe7x2nKRwheg8trbqqWY0FaEPwXYLyqbuWxwO8uywwv+iTVvoz4LX7BQP13GQfuqOoTAUJooWUtAmQIPD9klFZmUapVe5naX+t4KHyf7lboPAYQl1exzqEvapgJ68GWl+R5q9bu56Bf2FMs6cYMWqHkuZHO9zUI+hpAbkq5QA4aY3zsAss88Z9WZJ+W3eP7nqNkhwhlxJ51f9izyUALvIzqfjczU9lfc8g7BeDKDVLPFBHUqsL/gyuO/w9BbqIaLtn5D88=; 5:TdNmWABg1/LffnBFdvGm5Y+a4O0Xtww5TeKdYPUmcA3O3QK4f6fYcS2eFRqmgI8VwS+ZZo9nVpA3WJxJ9VUNPpA0fhEXM+GqcKvafpJUHFnc/mHLjMbTl/77mMcbIh34WEK70X4SheJdNTx1n8bSg7bmySQYn5GLVb8ec6XKyYs=; 24:z0OaEEg53ceIauI04GmlkvDGQp0Veujg66A/CAdYPfjO1atOmFg/gvz4sXE43aW1VtuF6UtoftArQ+PiQvN+/eDfao8ymMgtzm8V0WlrjhM=; 7:Wi3y6pliPu7BZLmGBTydm3xYHbQgK8oK+XdwPkMzeaOv+QqjQvCMTsOyBIHOfAHAKZpF/LORrWc0VdRMSxPxvgo/Cwzl9ibSAmQVNCkpoOl5T+yjES7RDl58kMyRoNIFHjA9uz96OMA5r61JHhdfXoq0TocfSJoTFZ9UhdiOZ1l1jSdxjxQ8VGKs3ORvTMFpSJ91EwqzD0zRd0YAeyZMC9fXhSdG9qsNBck3s0z4twwe32fzKGGoQ165S7fw36Jd x-incomingheadercount: 46 x-eopattributedmessage: 0 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(201702061074)(5061506573)(5061507331)(1603103135)(2017031320274)(2017031324274)(2017031323274)(2017031322404)(1601125374)(1603101448)(1701031045); SRVR:AM5EUR03HT033; x-ms-traffictypediagnostic: AM5EUR03HT033: x-ms-office365-filtering-correlation-id: 6b12c390-85ea-4d0e-d810-08d53dac9023 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(444000031); SRVR:AM5EUR03HT033; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:AM5EUR03HT033; x-forefront-prvs: 05143A8241 x-forefront-antispam-report: SFV:NSPM; SFS:(7070007)(98901004); DIR:OUT; SFP:1901; SCL:1; SRVR:AM5EUR03HT033; H:DB3PR0202MB3452.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6b12c390-85ea-4d0e-d810-08d53dac9023 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Dec 2017 19:56:11.2543 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5EUR03HT033 Subject: [FFmpeg-devel] [PATCH v3 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function 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" On 07.12.2017 at 17:41 Michael Niedermayer wrote: > The move and the functional change should be in seperate patches > that keeps changes easy to read and understand > > [...] >From b5d6c40c6516b90abeeffb7cf8ecd1ca1c3f7cb2 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Thu, 7 Dec 2017 20:37:48 +0100 Subject: [PATCH 1/2] libavcodec/hevc_filter: move AVDISCARD_NONREF switch-case into function In preparation for implementation of skip_frame. --- libavcodec/hevc_filter.c | 20 +++----------------- libavcodec/hevcdec.h | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/libavcodec/hevc_filter.c b/libavcodec/hevc_filter.c index 94fb7cd3d1..6b9824088c 100644 --- a/libavcodec/hevc_filter.c +++ b/libavcodec/hevc_filter.c @@ -842,29 +842,15 @@ void ff_hevc_deblocking_boundary_strengths(HEVCContext *s, int x0, int y0, void ff_hevc_hls_filter(HEVCContext *s, int x, int y, int ctb_size) { int x_end = x >= s->ps.sps->width - ctb_size; - int skip = 0, is_n = 0; - switch (s->nal_unit_type) { - case HEVC_NAL_TRAIL_N: - case HEVC_NAL_TSA_N: - case HEVC_NAL_STSA_N: - case HEVC_NAL_RADL_N: - case HEVC_NAL_RASL_N: - case HEVC_NAL_VCL_N10: - case HEVC_NAL_VCL_N12: - case HEVC_NAL_VCL_N14: - case HEVC_NAL_BLA_N_LP: - case HEVC_NAL_IDR_N_LP: - is_n = 1; - break; - default: break; - } + int skip = 0; if (s->avctx->skip_loop_filter >= AVDISCARD_ALL || (s->avctx->skip_loop_filter >= AVDISCARD_NONKEY && !IS_IDR(s)) || (s->avctx->skip_loop_filter >= AVDISCARD_NONINTRA && s->sh.slice_type != HEVC_SLICE_I) || (s->avctx->skip_loop_filter >= AVDISCARD_BIDIR && s->sh.slice_type == HEVC_SLICE_B) || - (s->avctx->skip_loop_filter >= AVDISCARD_NONREF && is_n)) + (s->avctx->skip_loop_filter >= AVDISCARD_NONREF && + ff_hevc_nal_is_nonref(s->nal_unit_type))) skip = 1; if (!skip) diff --git a/libavcodec/hevcdec.h b/libavcodec/hevcdec.h index ef918f4fb2..b311edc8ae 100644 --- a/libavcodec/hevcdec.h +++ b/libavcodec/hevcdec.h @@ -548,6 +548,26 @@ int ff_hevc_frame_nb_refs(HEVCContext *s); int ff_hevc_set_new_ref(HEVCContext *s, AVFrame **frame, int poc); +static av_always_inline int ff_hevc_nal_is_nonref(enum HEVCNALUnitType type) +{ + switch (type) { + case HEVC_NAL_TRAIL_N: + case HEVC_NAL_TSA_N: + case HEVC_NAL_STSA_N: + case HEVC_NAL_RADL_N: + case HEVC_NAL_RASL_N: + case HEVC_NAL_VCL_N10: + case HEVC_NAL_VCL_N12: + case HEVC_NAL_VCL_N14: + case HEVC_NAL_BLA_N_LP: + case HEVC_NAL_IDR_N_LP: + return 1; + break; + default: break; + } + return 0; +} + /** * Find next frame in output order and put a reference to it in frame. * @return 1 if a frame was output, 0 otherwise -- 2.15.0