From patchwork Sun Jun 9 01:39:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 49720 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a59:c209:0:b0:460:55fa:d5ed with SMTP id d9csp1815702vqo; Sat, 8 Jun 2024 18:39:56 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVyevSIfCpUn26+wYZitFTSu4SDm8Mq5zHo3adNV5SrLj0a7Eojj77D3rJvelHvq2kU8KBjpvhVl1avizwsn4I1dgpXlo3lba4mtA== X-Google-Smtp-Source: AGHT+IF1UxVaP+QsVZR8syx1Xi3wC9uO/loNFCY3JoSabwewp4wBwSP++cxH3nncb4WHSJqFtSB+ X-Received: by 2002:a17:906:4417:b0:a6d:ff12:5bda with SMTP id a640c23a62f3a-a6dff125d37mr264536566b.0.1717897196466; Sat, 08 Jun 2024 18:39:56 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id a640c23a62f3a-a6c807044desi334477966b.497.2024.06.08.18.39.55; Sat, 08 Jun 2024 18:39:56 -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=@outlook.com header.s=selector1 header.b=QUKIH4H2; arc=fail (body hash mismatch); 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=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9121168D72C; Sun, 9 Jun 2024 04:39:51 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02olkn2072.outbound.protection.outlook.com [40.92.50.72]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A90A168D5C2 for ; Sun, 9 Jun 2024 04:39:44 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gT1VjnuvrYwiwzdtM12sE6N+0mm6W62BJf/s9yEijI/urpta1slWiUL7LnyCTAklmIgoU2uAHFlgYIcCuJvox817fMqqlX7zmPoANftNaxzJ3M+Os7TFaoJ1u1yZO8FXi9eXZnogbzl69VdcbYE+f3o7utTn41jgk0komSW30lvGvoKa20/v1Fn68deJqYE3AQx50aWs+m7cYwfSAv2KJXBnIXZK9b8JhUpH4SqYsf3E21SihIXnkjad/N1PiAA1+Q5wDLhzSvaOYBRPiai76lI3RN3+NnCIgVHdJUke0SppnSS+pWP+Mu5KqXOj8BWO682iB9+NWjpDRkDS0ke3BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+I5Mwyzcazpmqk2aUDqQ3plKS3bLlP+NzK3fjiMYkXs=; b=RkSi5A9Mj4LKxlOkfJ4oNTFfxqBPqFFU8jtYfFJS2xMVHDlsh/EGFWVzuGEHlYqgijEaZNCs85nRsDmV8ivUJVpTO7rS1VavteVS6JP9ZBt7cfpq6Pa5wUbTLPpDol+a08zddJn3/ub27MpyxkfZFpTsiulHYBa+y4QCkiUfRY8O5LbU+51ZNTZmpD+Gm/FQTeSKVi+sGMLwv4I5Ra7BKvMh1NmpL+XF2jkr3gOuMOMGo8dHH25+BXsCGWxbvW4hkGQ7OYWgy0pQmgTuzMYhR+KoT6ixAnFJ8+izr5sPNb4W1nLLQ6VlKNWFKF6pAmRlOil3D2cy8rEqKoxcrjsf0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+I5Mwyzcazpmqk2aUDqQ3plKS3bLlP+NzK3fjiMYkXs=; b=QUKIH4H2asdWDMS6LCe9UtLLpUGUB5gKhaAKihNnLpsRdoONjjcGYWp41AcjX7bGV7n0mVBDzbfDyIus9MAuWHZFsdgU2A58e6shpmV6yS4uUKarRgj2zrIpRPRDY21cGGx/tear0ukOrIefda4ERcrfA5BAMtFYQUCB+iQDH0VvHSwRYeSszYgXk14M2gUnxALqDfYL2/TQcEzYCyDmw+jfCZv1t0uY3pv3OUZ7ESys/IgFtpPSRRV8le2CDn5yHS1tlh4XflZQ82mH41+MXM7nocABvEzeMaWtM561SjBVyTZE7tVgGLiKvSeZYHguy6+1YKOMUJbbtSwYrkvfcA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by DB9P250MB0401.EURP250.PROD.OUTLOOK.COM (2603:10a6:10:331::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.36; Sun, 9 Jun 2024 01:39:40 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::384d:40d4:ecb7:1c9%4]) with mapi id 15.20.7633.021; Sun, 9 Jun 2024 01:39:40 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sun, 9 Jun 2024 03:39:32 +0200 Message-ID: X-Mailer: git-send-email 2.40.1 X-TMN: [cabLxDZAZHihtZZWHLpob66db3K9lHUEUpWX5HD8/WE=] X-ClientProxiedBy: FR2P281CA0074.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9a::16) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240609013932.2857243-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|DB9P250MB0401:EE_ X-MS-Office365-Filtering-Correlation-Id: ffa4ee76-fc98-4038-1d02-08dc882507c4 X-Microsoft-Antispam: BCL:0; ARA:14566002|461199019|3412199016|440099019|1710799017; X-Microsoft-Antispam-Message-Info: H/U6MY0QKb96QHbW6l5VAQq6ztyNH1n8DmgR6xRBcLIhmnXUgIoxOjzA2fy21VeM6oxbCLwB0SGdXhD6ou1NImpi6nz20ngldyjQQwWSvdYb3jy/zY0JCUtfpETLcVLSmBEPunqzEfxTlne/t8OluMxKDP2lVQfTH1YBhAhwq4bizivnm+a88Zq+7r93hl2MzphfY/6dWnBCwLBw4J1j+WfehEWieK1armOpzYB+LWheaTsJGrBhRU2jU2rz/kuE/VXA6/GaP2tjvHDAuoCVHdwbDPIRAgM+jC6Ti2MAoqLB0QXUzbHuKeisYxKnhlJljGax746AYBaeZ3cqnBd+1iLv20fyeCrwaJ2e9kxV1dceq7PT1YcTqs2GRzf1ujB83K7eNrBJHjaYujcApGzIgXRI6CSlQ5qj7pqwIvSl8pMntE0Uqxr5Id9fBEJpJX6f8EdyOPHobNkrIihM0sVZX3ev15nqJ24E/pFDM6US8u+m8PwqdVM+NkmNjJHJ+cqOvEMuU7+KDwRgnAq6PDv/wlKg9548+K+ISw/Aimz3vXAtD0kxssCuttMCfsKGSE8zPjHpTgGDBtH/DqyrnByJ56VxS+PDfP6hpIYf1bgyxABGsWCQmvHg2pAg5BAmox4Q X-MS-Exchange-AntiSpam-MessageData-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JxAgGzymBoHerVoIcj+S1h4KM9c8qXs/vQk5ycL+pdGPLb3UpVS9gqT+RaNSsBAEz4NFnanIko46vBcNBzfgfSMdH0wj9wlUC43dQAkRZj46oi+cg8JuPwXzT2VOnSjrAEGgPkB093ouLQmlVWv0ThbDdGEcy+Kd37DmVvmOxKKxGfShSYdP9NbyHztIGNd0DU9x5uQAEBkgvc+QazzdEaxVO8FZA2x/66D7ovvmYgOyfiHKRX7MsLSNfZzL4joNA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ffa4ee76-fc98-4038-1d02-08dc882507c4 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2024 01:39:40.7260 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P250MB0401 Subject: [FFmpeg-devel] [PATCH v2] avcodec/h264dec: Remove ff_h264_draw_horiz_band 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 0zNH7B2ylX3s The H.264 decoder does not support draw_horiz_band (it does not have the AV_CODEC_CAP_DRAW_HORIZ_BAND), making ff_h264_draw_horiz_band() legally dead. The function here always calls draw_horiz_band in coded order, although the default case is display order. Signed-off-by: Andreas Rheinhardt --- libavcodec/d3d12va_h264.c | 12 ++++-------- libavcodec/dxva2_h264.c | 13 ++++--------- libavcodec/h264_slice.c | 2 -- libavcodec/h264dec.c | 39 --------------------------------------- libavcodec/h264dec.h | 2 -- libavcodec/vaapi_h264.c | 11 +---------- libavcodec/vdpau_h264.c | 2 -- 7 files changed, 9 insertions(+), 72 deletions(-) diff --git a/libavcodec/d3d12va_h264.c b/libavcodec/d3d12va_h264.c index b2fe2955c8..fe23f083df 100644 --- a/libavcodec/d3d12va_h264.c +++ b/libavcodec/d3d12va_h264.c @@ -163,14 +163,10 @@ static int d3d12va_h264_end_frame(AVCodecContext *avctx) if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_d3d12va_common_end_frame(avctx, h->cur_pic_ptr->f, - &ctx_pic->pp, sizeof(ctx_pic->pp), - &ctx_pic->qm, sizeof(ctx_pic->qm), - update_input_arguments); - if (!ret) - ff_h264_draw_horiz_band(h, sl, 0, h->avctx->height); - - return ret; + return ff_d3d12va_common_end_frame(avctx, h->cur_pic_ptr->f, + &ctx_pic->pp, sizeof(ctx_pic->pp), + &ctx_pic->qm, sizeof(ctx_pic->qm), + update_input_arguments); } static int d3d12va_h264_decode_init(AVCodecContext *avctx) diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 0fe4152625..a6fbf61ea9 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -502,20 +502,15 @@ static int dxva2_h264_decode_slice(AVCodecContext *avctx, static int dxva2_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; - H264SliceContext *sl = &h->slice_ctx[0]; struct dxva2_picture_context *ctx_pic = h->cur_pic_ptr->hwaccel_picture_private; - int ret; if (ctx_pic->slice_count <= 0 || ctx_pic->bitstream_size <= 0) return -1; - ret = ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, - &ctx_pic->pp, sizeof(ctx_pic->pp), - &ctx_pic->qm, sizeof(ctx_pic->qm), - commit_bitstream_and_slice_buffer); - if (!ret) - ff_h264_draw_horiz_band(h, sl, 0, h->avctx->height); - return ret; + return ff_dxva2_common_end_frame(avctx, h->cur_pic_ptr->f, + &ctx_pic->pp, sizeof(ctx_pic->pp), + &ctx_pic->qm, sizeof(ctx_pic->qm), + commit_bitstream_and_slice_buffer); } #if CONFIG_H264_DXVA2_HWACCEL diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index ce2c4caca1..ceca1d1046 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -2523,8 +2523,6 @@ static void decode_finish_row(const H264Context *h, H264SliceContext *sl) top = 0; } - ff_h264_draw_horiz_band(h, sl, top, height); - if (h->droppable || h->er.error_occurred) return; diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c index fd23e367b4..a09714b714 100644 --- a/libavcodec/h264dec.c +++ b/libavcodec/h264dec.c @@ -30,7 +30,6 @@ #include "config_components.h" #include "libavutil/avassert.h" -#include "libavutil/emms.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/opt.h" @@ -100,44 +99,6 @@ static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, ff_h264_hl_decode_mb(h, &h->slice_ctx[0]); } -void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, - int y, int height) -{ - AVCodecContext *avctx = h->avctx; - const AVFrame *src = h->cur_pic.f; - const AVPixFmtDescriptor *desc; - int offset[AV_NUM_DATA_POINTERS]; - int vshift; - const int field_pic = h->picture_structure != PICT_FRAME; - - if (!avctx->draw_horiz_band) - return; - - if (field_pic && h->first_field && !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) - return; - - if (field_pic) { - height <<= 1; - y <<= 1; - } - - height = FFMIN(height, avctx->height - y); - - desc = av_pix_fmt_desc_get(avctx->pix_fmt); - vshift = desc->log2_chroma_h; - - offset[0] = y * src->linesize[0]; - offset[1] = - offset[2] = (y >> vshift) * src->linesize[1]; - for (int i = 3; i < AV_NUM_DATA_POINTERS; i++) - offset[i] = 0; - - emms_c(); - - avctx->draw_horiz_band(avctx, src, offset, - y, h->picture_structure, height); -} - void ff_h264_free_tables(H264Context *h) { int i; diff --git a/libavcodec/h264dec.h b/libavcodec/h264dec.h index fc50df90f2..c73c6d085a 100644 --- a/libavcodec/h264dec.h +++ b/libavcodec/h264dec.h @@ -677,8 +677,6 @@ void ff_h264_unref_picture(H264Picture *pic); void ff_h264_slice_context_init(H264Context *h, H264SliceContext *sl); -void ff_h264_draw_horiz_band(const H264Context *h, H264SliceContext *sl, int y, int height); - /** * Submit a slice for decoding. * diff --git a/libavcodec/vaapi_h264.c b/libavcodec/vaapi_h264.c index 398e92568c..670d3273cb 100644 --- a/libavcodec/vaapi_h264.c +++ b/libavcodec/vaapi_h264.c @@ -319,17 +319,8 @@ static int vaapi_h264_end_frame(AVCodecContext *avctx) { const H264Context *h = avctx->priv_data; VAAPIDecodePicture *pic = h->cur_pic_ptr->hwaccel_picture_private; - H264SliceContext *sl = &h->slice_ctx[0]; - int ret; - ret = ff_vaapi_decode_issue(avctx, pic); - if (ret < 0) - goto finish; - - ff_h264_draw_horiz_band(h, sl, 0, h->avctx->height); - -finish: - return ret; + return ff_vaapi_decode_issue(avctx, pic); } /** Decode the given H.264 slice with VA API. */ diff --git a/libavcodec/vdpau_h264.c b/libavcodec/vdpau_h264.c index 9c08e4048c..432027f924 100644 --- a/libavcodec/vdpau_h264.c +++ b/libavcodec/vdpau_h264.c @@ -201,7 +201,6 @@ static int vdpau_h264_decode_slice(AVCodecContext *avctx, static int vdpau_h264_end_frame(AVCodecContext *avctx) { H264Context *h = avctx->priv_data; - H264SliceContext *sl = &h->slice_ctx[0]; H264Picture *pic = h->cur_pic_ptr; struct vdpau_picture_context *pic_ctx = pic->hwaccel_picture_private; int val; @@ -210,7 +209,6 @@ static int vdpau_h264_end_frame(AVCodecContext *avctx) if (val < 0) return val; - ff_h264_draw_horiz_band(h, sl, 0, h->avctx->height); return 0; }