From patchwork Fri Jun 7 13:01:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 49660 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1011194vqo; Fri, 7 Jun 2024 06:07:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUA0o9ZMMC968UqJw3b6Ph7HEKEFATR6Kn2R0m31trfA6TIOaIn/59Qql1OSLwxJ4me1jlqTdltHPdGdbMVI/PzAnQZ8cWZ7t2llA== X-Google-Smtp-Source: AGHT+IGKlVTbA7hFB0E3W+FYFVnRPGvixf2V900zH69/5VDA2jncZb1xEnk3PI2WPeeqn5SKwwCy X-Received: by 2002:a05:6512:1598:b0:52b:7a10:353d with SMTP id 2adb3069b0e04-52bb9fc974amr1963381e87.43.1717765675543; Fri, 07 Jun 2024 06:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1717765675; cv=none; d=google.com; s=arc-20160816; b=mXdFs5YnwcwSu46DGZf/6C0AQU2YFoXx03/jDGQflz3+hTJv8jsznfum3gszgs32yI kIC2Z+XLszfdtsbGQySqUviLrRjmIPfL8vEdJL7WGS7NKovEsWaGiqKFbu8/mBc/Y03R Sv8duQOTK2ffT/Q4MLxRlgs0AaZ6nM3ccDzH6/WsIq2kp3Q2Gxd0n2D0EglO5kvJdKJy 30i9/MbNMUOzF4ySqUSD++86+aufBnmMbkAdCeZZC/Y5G+4JyNrJExZRNsiJtRRIXMXq nSUIUT1KcDBk5zeBi0rvjbQbVeymGN5RQ7lMYsImtcKDjwEo15JR2p2wURXyIOyvQTKn 3S5Q== 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:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=qHMky4/KjP/xfVZUDHxtflBMtuqjkNm4JeD1rY9MEWA=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=N15NhZH7PQRlkr/KwjZmyqZNbWEo7S9+edz29vWufOKcLHjsr/klocltV/wkEU4pRc XOuLgClSIRlk19lrwr6dasv+09oAvgRXergNxnCXzcLN1lpisYwe64RQ1KJYQ6xv/UJG s8jf7vdkFm1o5U30MPHs0SUwZlTX8xv+xNNPSyOWt22Y7flffkjtmeEpR9bIlsCxM315 8gphtLLmmT4fSxLCE0xZUK2C8nKdqyx1X1hVKhY1IZaoLCHjtLlAjr7R1ZjvtPIhX6CU 5gxii2bBtdvJi0TCR0uAVtLckH4LCSzR6t1PLkQwKq75kfKO/XZxZZcCzspJf48NlmzI 4ycg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@khirnov.net header.s=mail header.b=Kh0hb95C; 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 2adb3069b0e04-52bc3144befsi82810e87.328.2024.06.07.06.07.54; Fri, 07 Jun 2024 06:07:55 -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=@khirnov.net header.s=mail header.b=Kh0hb95C; 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 7D17668D82F; Fri, 7 Jun 2024 16:04:19 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail1.khirnov.net (quelana.khirnov.net [94.230.150.81]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E7B9868D76F for ; Fri, 7 Jun 2024 16:03:50 +0300 (EEST) Authentication-Results: mail1.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=Kh0hb95C; dkim-atps=neutral Received: from localhost (mail1.khirnov.net [IPv6:::1]) by mail1.khirnov.net (Postfix) with ESMTP id D0A3B4D76 for ; Fri, 7 Jun 2024 15:03:50 +0200 (CEST) Received: from mail1.khirnov.net ([IPv6:::1]) by localhost (mail1.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id IcLn3_T2jUsg for ; Fri, 7 Jun 2024 15:03:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1717765422; bh=zXRNmjRmisussH92dLzqYKLX0QfbocptqStO8woikSY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Kh0hb95C2emLxOiqOvl+pio85hCsX7FsYqA3DxVRbjs6gufHtvEhBxymBWFH2SBl1 8lc7y/qPGv2d/I7PvjjuStFRmAhJUl4KeMN7YrzkcyAawx4JpCr0jVRuKw9cCB4DV+ TvQ0ReBGGQnzZJtoKcSzP/JwQ8Tneoy5UZ0CkrilzqPhlwwBJINqXAAvENWUyUk93y RH82DNxQv6vfhpwWxd78ypDWeHKhr5FkXncd5rt25z3dVfRL603zGDaxo8ftYkLCmw HVrL8ErXOQZF/woVfWeakWe4oBhmik2z/yLLBRNEd15PWz4NOKf5w5akIZSRm+z7uN nAlvZyH9HKPNg== Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail1.khirnov.net (Postfix) with ESMTPS id 7CBB44E05 for ; Fri, 7 Jun 2024 15:03:42 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id AB84F3A1A4F for ; Fri, 07 Jun 2024 15:03:35 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 7 Jun 2024 15:01:25 +0200 Message-ID: <20240607130135.9088-29-anton@khirnov.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240607130135.9088-1-anton@khirnov.net> References: <20240607130135.9088-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 29/39] lavc/hevcdec: move calling hwaccel decode_slice to decode_slice_data() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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" X-TUID: zX0uXfDGNjPI From decode_nal_unit(), as that is a more appropriate place for it. --- libavcodec/hevc/hevcdec.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c index 0bf68ea45c..c148244361 100644 --- a/libavcodec/hevc/hevcdec.c +++ b/libavcodec/hevc/hevcdec.c @@ -2811,6 +2811,15 @@ static int decode_slice_data(HEVCContext *s, const H2645NAL *nal, GetBitContext } } + if (s->avctx->hwaccel) + return FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size); + + if (s->avctx->profile == AV_PROFILE_HEVC_SCC) { + av_log(s->avctx, AV_LOG_ERROR, + "SCC profile is not yet implemented in hevc native decoder.\n"); + return AVERROR_PATCHWELCOME; + } + s->local_ctx[0].first_qp_group = !s->sh.dependent_slice_segment_flag; if (!pps->cu_qp_delta_enabled_flag) @@ -3152,30 +3161,17 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) } } - if (s->avctx->hwaccel) { - ret = FF_HW_CALL(s->avctx, decode_slice, nal->raw_data, nal->raw_size); + ctb_addr_ts = decode_slice_data(s, nal, &gb); + if (ctb_addr_ts >= s->cur_frame->ctb_count) { + ret = hevc_frame_end(s); if (ret < 0) goto fail; - } else { - if (s->avctx->profile == AV_PROFILE_HEVC_SCC) { - av_log(s->avctx, AV_LOG_ERROR, - "SCC profile is not yet implemented in hevc native decoder.\n"); - ret = AVERROR_PATCHWELCOME; - goto fail; - } + s->is_decoded = 1; + } - ctb_addr_ts = decode_slice_data(s, nal, &gb); - if (ctb_addr_ts >= s->cur_frame->ctb_count) { - ret = hevc_frame_end(s); - if (ret < 0) - goto fail; - s->is_decoded = 1; - } - - if (ctb_addr_ts < 0) { - ret = ctb_addr_ts; - goto fail; - } + if (ctb_addr_ts < 0) { + ret = ctb_addr_ts; + goto fail; } break; case HEVC_NAL_EOS_NUT: