From patchwork Thu Feb 17 09:13:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 34353 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:d078:0:0:0:0 with SMTP id x24csp459100nkx; Thu, 17 Feb 2022 01:13:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJxZsHPeUKVs5JdO+i6RuKo2dEh2q6Lli9Yu7L75dBiqo0Q2XA4Z0lIOipzGO6voXJQa5k9g X-Received: by 2002:a17:906:6b01:b0:6cf:624c:d98d with SMTP id q1-20020a1709066b0100b006cf624cd98dmr1532554ejr.673.1645089237416; Thu, 17 Feb 2022 01:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645089237; cv=none; d=google.com; s=arc-20160816; b=RyFQmMFcpqgz0yfAXzPv7k2nPOcnLrZ7CaesKxLlQQhAJxBoydYKXKKtZ8fFKjaEaN RKy2vwv2fNKgt+jXpuWsFDweMFkrVj6MApK+YoMyevV4034K9QBxxIE693t0imq1HTNv 73UcmARnDmJHMjn4VJ+R0PFWxLuEGoSQKr/QtUcTI8VnAQuVfmPiXCnk9UhK2VHAA6/R HNmlGcCu0j4eYt6Lc4RPKHTaHKS50pNSbtyg3p0Oq2fZZ5h2+NrXIzqtLkEDds1DY8T7 DsNFldVezKLRwWyoc0/JxAAinhYREQjzZZpP6j7/U0ea1Gs5tdCFtfzHIXDYVW5hivD6 yYYA== 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:delivered-to; bh=9hk97bVPtQh0cQf81UgueNKVopj8i9m0FqLeCKxA+W0=; b=kwo2ae/lOL0e1L/9x0l3yhq54ytZk4xzxp4WBLZzB1Q0vZUFozJ43JI50pVjzQw9yt UhwU/Aj4eMPQuAnBM56OSiCS+gd0vT8P8Z3iTZfaD0X2hf8vZMKvrBst2qF/00l7yF4x CUON1QFxnGDnFdTO2HRrNwYt/ZY8V1rQfTBn7AQV4kufmS/yahIlSlfZ9iRqLFfjj00j HrpgNmcRn3XlqitdsvxV3+g5zfFcL4f9OH/AfIPjwt0zt9mbplFDilI03EHYgXNVrV79 MNeGrKre+d90Nb7+CENctTHdX0TZfMEoZ3rGX9quag9WonGUJcIjZY6+h2RxljAHyVlB cKlQ== 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 w19si3692453edc.225.2022.02.17.01.13.52; Thu, 17 Feb 2022 01:13:57 -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 C24D768B0F9; Thu, 17 Feb 2022 11:13:31 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AB69F68AF73 for ; Thu, 17 Feb 2022 11:13:23 +0200 (EET) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 1049124017C for ; Thu, 17 Feb 2022 10:13:23 +0100 (CET) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id Y1QzNRaguCGk for ; Thu, 17 Feb 2022 10:13:21 +0100 (CET) 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 mail0.khirnov.net (Postfix) with ESMTPS id 849EE240179 for ; Thu, 17 Feb 2022 10:13:21 +0100 (CET) Received: by libav.khirnov.net (Postfix, from userid 1000) id 95DFF3A0189; Thu, 17 Feb 2022 10:13:17 +0100 (CET) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Feb 2022 10:13:15 +0100 Message-Id: <20220217091315.21092-2-anton@khirnov.net> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220217091315.21092-1-anton@khirnov.net> References: <20220217091315.21092-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] lavc/dxva: properly namespace public symbols 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: DKov8C9OwYhq --- doc/APIchanges | 6 ++++++ libavcodec/dxva2.c | 4 ++-- libavcodec/dxva2.h | 18 ++++++++++++++---- libavcodec/dxva2_h264.c | 8 ++++---- libavcodec/dxva2_internal.h | 4 ++-- libavcodec/version.h | 3 ++- 6 files changed, 30 insertions(+), 13 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index ea402f6118..3447872752 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,12 @@ libavutil: 2021-04-27 API changes, most recent first: +2022-02-xx - xxxxxxxxxx - lavc 59.22.100 - dxva2.h + Rename struct dxva_context to (typedeffed) AVDXVA2DecodeContext. + Rename FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG and FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO + to AV_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG and AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO, + respectively. The previous names are now deprecated. + 2022-02-07 - xxxxxxxxxx - lavu 57.21.100 - fifo.h Deprecate AVFifoBuffer and the API around it, namely av_fifo_alloc(), av_fifo_alloc_array(), av_fifo_free(), av_fifo_freep(), av_fifo_reset(), diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index c31a71ba3b..ab6995940b 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -299,7 +299,7 @@ static int dxva_get_decoder_guid(AVCodecContext *avctx, void *service, void *sur } if (IsEqualGUID(decoder_guid, &ff_DXVADDI_Intel_ModeH264_E)) - sctx->workaround |= FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO; + sctx->workaround |= AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO; return 0; } @@ -704,7 +704,7 @@ int ff_dxva2_decode_init(AVCodecContext *avctx) #if CONFIG_DXVA2 if (sctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD) { AVDXVA2FramesContext *frames_hwctx = frames_ctx->hwctx; - struct dxva_context *dxva_ctx = &sctx->ctx.dxva2; + AVDXVA2DecodeContext *dxva_ctx = &sctx->ctx.dxva2; ff_dxva2_lock(avctx); ret = dxva2_create_decoder(avctx); diff --git a/libavcodec/dxva2.h b/libavcodec/dxva2.h index 22c93992f2..7892da693c 100644 --- a/libavcodec/dxva2.h +++ b/libavcodec/dxva2.h @@ -45,8 +45,13 @@ * @{ */ -#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards -#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface +#define AV_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards +#define AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO 2 ///< Work around for DXVA2 and old Intel GPUs with ClearVideo interface + +#if FF_API_DXVA_NAMING +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG AV_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG +#define FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO +#endif /** * This structure is used to provides the necessary configurations and data @@ -54,7 +59,12 @@ * * The application must make it available as AVCodecContext.hwaccel_context. */ -struct dxva_context { +typedef struct +#if FF_API_DXVA_NAMING +dxva_context +#else +AVDXVA2DecodeContext +{ /** * DXVA2 decoder object */ @@ -84,7 +94,7 @@ struct dxva_context { * Private to the FFmpeg AVHWAccel implementation */ unsigned report_id; -}; +} AVDXVA2DecodeContext; /** * @} diff --git a/libavcodec/dxva2_h264.c b/libavcodec/dxva2_h264.c index 489b9bb0f5..f4d6098e0e 100644 --- a/libavcodec/dxva2_h264.c +++ b/libavcodec/dxva2_h264.c @@ -119,9 +119,9 @@ static void fill_picture_parameters(const AVCodecContext *avctx, DXVAContext *ct pp->bit_depth_luma_minus8 = sps->bit_depth_luma - 8; pp->bit_depth_chroma_minus8 = sps->bit_depth_chroma - 8; - if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) + if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & AV_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) pp->Reserved16Bits = 0; - else if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) + else if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) pp->Reserved16Bits = 0x34c; else pp->Reserved16Bits = 3; /* FIXME is there a way to detect the right mode ? */ @@ -166,7 +166,7 @@ static void fill_scaling_lists(const AVCodecContext *avctx, DXVAContext *ctx, co const PPS *pps = h->ps.pps; unsigned i, j; memset(qm, 0, sizeof(*qm)); - if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) { + if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & AV_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG) { for (i = 0; i < 6; i++) for (j = 0; j < 16; j++) qm->bScalingLists4x4[i][j] = pps->scaling_matrix4[i][j]; @@ -249,7 +249,7 @@ static void fill_slice_long(AVCodecContext *avctx, DXVA_Slice_H264_Long *slice, const H264Picture *r = sl->ref_list[list][i].parent; unsigned plane; unsigned index; - if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & FF_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) + if (DXVA_CONTEXT_WORKAROUND(avctx, ctx) & AV_DXVA2_WORKAROUND_INTEL_CLEARVIDEO) index = ff_dxva2_get_surface_index(avctx, ctx, r->f); else index = get_refpic_index(pp, ff_dxva2_get_surface_index(avctx, ctx, r->f)); diff --git a/libavcodec/dxva2_internal.h b/libavcodec/dxva2_internal.h index d14b696a3b..987d89a2cf 100644 --- a/libavcodec/dxva2_internal.h +++ b/libavcodec/dxva2_internal.h @@ -60,14 +60,14 @@ typedef union { struct AVD3D11VAContext d3d11va; #endif #if CONFIG_DXVA2 - struct dxva_context dxva2; + AVDXVA2DecodeContext dxva2; #endif } DXVAContext; typedef struct FFDXVASharedContext { AVBufferRef *decoder_ref; - // FF_DXVA2_WORKAROUND_* flags + // AV_DXVA2_WORKAROUND_* flags uint64_t workaround; // E.g. AV_PIX_FMT_D3D11 (same as AVCodecContext.pix_fmt, except during init) diff --git a/libavcodec/version.h b/libavcodec/version.h index d900503954..2da6b21497 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 59 -#define LIBAVCODEC_VERSION_MINOR 21 +#define LIBAVCODEC_VERSION_MINOR 22 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ @@ -65,5 +65,6 @@ #define FF_API_SUB_TEXT_FORMAT (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_MJPEG_PRED (LIBAVCODEC_VERSION_MAJOR < 60) #define FF_API_IDCT_NONE (LIBAVCODEC_VERSION_MAJOR < 60) +#define FF_API_DXVA_NAMING (LIBAVCODEC_VERSION_MAJOR < 60) #endif /* AVCODEC_VERSION_H */