From patchwork Sun Jan 28 21:13:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Connor Worley X-Patchwork-Id: 45871 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:8786:b0:199:de12:6fa6 with SMTP id ph6csp1196139pzb; Sun, 28 Jan 2024 13:14:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLyZzSxDMUYMzFowEBWWXpNBIsr2PSehb+X4W1GWHrkFxLIAVFo8PH+Unmn0eg6KlWjx3N X-Received: by 2002:a05:6402:2709:b0:55c:8b81:87f2 with SMTP id y9-20020a056402270900b0055c8b8187f2mr3512741edd.31.1706476446812; Sun, 28 Jan 2024 13:14:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1706476446; cv=none; d=google.com; s=arc-20160816; b=UDJi/bXCPz4BYNI1maPd9d2U5Xf45ICterW9botwRsxJ+BhzTh4C40T80ZjDV5stsg ILTSG5MaEYUaruzt3HmIbRXd0mAen0hRhbX0kJM/usXpRPHXKnqhKJ/8jYXMR3QkI9pL 1I0s8HaLRG5Vhb/cfYipAgcb4fUkbF2gCcR/6XtULgRr7n1HOc8zBBr4cbsvbFchRlIL 8YCj589/EmuCv6R8ed7kJuufMDMs2rANAeL829ScnJqfm6wb1Y6/wrVadBOaJkEw4la3 4Zhf7GcuVuYBXiE3U61ezxa7CMvHBHMPS3ah2PZXwv46DyNMqt9XG899sF5OElXIAgqk LqeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:message-id:date:to:from :dkim-signature:delivered-to; bh=i0hM6WJI+fkbxaKKS7b32umTaykPqQ3SorXect9Qa/w=; fh=4o9WedBEbOrq7GvNs0s+TOKeyzmDZRM3O7oe6ZP6vYM=; b=nnJn6jP5AvlVdGmEWNhI7zM9opBkqiLDGxOvYWhhb0jRrCNm2lPDHfDlfROda83Llw tpKFL6fvXsNl7mg2hhr06ZOKJER1kMZSq26pdEMy77W79MHrBSBQhHCADoKDu0SOC2RA Sd8AjxddVEp4jGY9OMtUQZxdHsPlKlcVEzqy3gRKx4S6sttqSeE1Bu+cZ28KskJ37pOL eHUvvovGEU1uN3xgV7rOYet98vGbOVEYJTnLHVBvzJQPzB4yMk6Rw1Wfy97axVNi8gag UDqCTFv7NSR0Om3cHMSzp0JY432egFpQQ8VKBF90g9eM0AFNK3QUmIPCj7s9KihVdt6s 5w/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=ZHbR1uES; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id dg13-20020a0564021d0d00b0055c2fd2bcadsi2815150edb.181.2024.01.28.13.14.06; Sun, 28 Jan 2024 13:14:06 -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; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=ZHbR1uES; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 113AE68D188; Sun, 28 Jan 2024 23:14:03 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C50868CD8E for ; Sun, 28 Jan 2024 23:13:56 +0200 (EET) Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-1d7881b1843so19336335ad.3 for ; Sun, 28 Jan 2024 13:13:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706476434; x=1707081234; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Otr4qS2WLEtLaBHUi1kLl0wD/9DrWiKuMNhjootbytg=; b=ZHbR1uES6Z0ILzOAn+J0UOoeZ2Revj8xXto9KNlKpmrqS8I6RV07QRAEVfM36iUWJx FWD4GEwO7iQynSj/xJ8dvYgLHc+3WCPAZriWP/juMdOtWfrH+UTI1KTTF0VvhQrjhyfg IQaYWFDSo3ZrmskRrvNgABHoNtprvV4KdWxgy9S5Ze4iiBccOHJzKELtcWybyaZtK+Ph MEFRSq8j6n/vrfWYhzGGd+ofHNREqfAA0tdPrD3JpycI+pxYvAXu6qbmyEAlSXfbhZYI xQWUA7+dPuL6NslRMgaWgx+dE/xkNR+rfV1+WPVea59WzhZaihPwRIjl6nDZsLQqsUPG yFgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706476434; x=1707081234; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Otr4qS2WLEtLaBHUi1kLl0wD/9DrWiKuMNhjootbytg=; b=pqhnxkw2bss7YIKNNiZbx2+0xhRfPtseFtjBPCResiS9GuQEXjFtp7HfNxVOYlj2U6 9gXdSFitXlUDtCg82S4yFKS498pp1pTFOpyAa0pLst/rTO89f1OLe82A8VxtIih+1HIh yJMkTngBJN/aF6OTF8firdSlr48TxntlqgkgNO0U0O+/pXWlSRipvX5xyDPC/ALPxzyE x0bL6WDX8RHv2DrZqLPjN/ozbGw2SFIY+ejd+DQTbse/rU7JLoGdmy8RP6yJawpHVy6h VDhlqJo15DgnirOyCNGF6yTWPcQjNqteKdpqyQoH7OnNb7Xus3W5m04VHWtz6Q4V0lcS orQQ== X-Gm-Message-State: AOJu0YzzCG1ANeZYRjbeH/FeXlwOE94DSTbudEUpWUsP1wmsv1RClA9g murYq6eC6retfuF1ja7CEfRPfu7yJ7pKYFpnVhWxu5h1L+IDjvIZ6rz/8/4EFC8= X-Received: by 2002:a17:902:d501:b0:1d8:e079:ce16 with SMTP id b1-20020a170902d50100b001d8e079ce16mr1110715plg.1.1706476433664; Sun, 28 Jan 2024 13:13:53 -0800 (PST) Received: from localhost ([2601:647:4600:84e0:cd8b:a23d:3457:1538]) by smtp.gmail.com with UTF8SMTPSA id ns1-20020a17090b250100b0028e821155efsm6892076pjb.46.2024.01.28.13.13.52 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 28 Jan 2024 13:13:53 -0800 (PST) From: Connor Worley To: ffmpeg-devel@ffmpeg.org Date: Sun, 28 Jan 2024 13:13:33 -0800 Message-Id: <20240128211335.58631-1-connorbworley@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/3] lavc/dxv: move tag definitions to common header 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: Connor Worley Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: RVWHdmEEP9Bc Signed-off-by: Connor Worley --- libavcodec/dxv.c | 9 +++++---- libavcodec/dxv.h | 34 ++++++++++++++++++++++++++++++++++ libavcodec/dxvenc.c | 7 ++----- 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 libavcodec/dxv.h diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c index 5923811b29..a2ae070984 100644 --- a/libavcodec/dxv.c +++ b/libavcodec/dxv.c @@ -28,6 +28,7 @@ #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" +#include "dxv.h" #include "lzf.h" #include "texturedsp.h" #include "thread.h" @@ -1064,7 +1065,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, tag = bytestream2_get_le32(gbc); switch (tag) { - case MKBETAG('D', 'X', 'T', '1'): + case DXV_FMT_DXT1: decompress_tex = dxv_decompress_dxt1; ctx->tex_funct = ctx->texdsp.dxt1_block; ctx->tex_rat = 8; @@ -1072,7 +1073,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, msgcomp = "DXTR1"; msgtext = "DXT1"; break; - case MKBETAG('D', 'X', 'T', '5'): + case DXV_FMT_DXT5: decompress_tex = dxv_decompress_dxt5; ctx->tex_funct = ctx->texdsp.dxt5_block; ctx->tex_rat = 4; @@ -1080,7 +1081,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, msgcomp = "DXTR5"; msgtext = "DXT5"; break; - case MKBETAG('Y', 'C', 'G', '6'): + case DXV_FMT_YCG6: decompress_tex = dxv_decompress_ycg6; ctx->tex_funct_planar[0] = yo_block; ctx->tex_funct_planar[1] = cocg_block; @@ -1097,7 +1098,7 @@ static int dxv_decode(AVCodecContext *avctx, AVFrame *frame, avctx->pix_fmt = AV_PIX_FMT_YUV420P; avctx->colorspace = AVCOL_SPC_YCOCG; break; - case MKBETAG('Y', 'G', '1', '0'): + case DXV_FMT_YG10: decompress_tex = dxv_decompress_yg10; ctx->tex_funct_planar[0] = yao_block; ctx->tex_funct_planar[1] = cocg_block; diff --git a/libavcodec/dxv.h b/libavcodec/dxv.h new file mode 100644 index 0000000000..71cfddec85 --- /dev/null +++ b/libavcodec/dxv.h @@ -0,0 +1,34 @@ +/* + * Resolume DXV common + * Copyright (C) 2024 Connor Worley + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXV_H +#define AVCODEC_DXV_H + +#include "libavutil/macros.h" + +typedef enum DXVTextureFormat { + DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), + DXV_FMT_DXT5 = MKBETAG('D', 'X', 'T', '5'), + DXV_FMT_YCG6 = MKBETAG('Y', 'C', 'G', '6'), + DXV_FMT_YG10 = MKBETAG('Y', 'G', '1', '0'), +} DXVTextureFormat; + +#endif /* AVCODEC_DXV_H */ diff --git a/libavcodec/dxvenc.c b/libavcodec/dxvenc.c index b274175689..6a67dd75d4 100644 --- a/libavcodec/dxvenc.c +++ b/libavcodec/dxvenc.c @@ -27,6 +27,7 @@ #include "bytestream.h" #include "codec_internal.h" +#include "dxv.h" #include "encode.h" #include "texturedsp.h" @@ -40,10 +41,6 @@ #define LOOKBACK_HT_ELEMS 0x40000 #define LOOKBACK_WORDS 0x20202 -enum DXVTextureFormat { - DXV_FMT_DXT1 = MKBETAG('D', 'X', 'T', '1'), -}; - typedef struct HTEntry { uint32_t key; uint32_t pos; @@ -120,7 +117,7 @@ typedef struct DXVEncContext { TextureDSPThreadContext enc; - enum DXVTextureFormat tex_fmt; + DXVTextureFormat tex_fmt; int (*compress_tex)(AVCodecContext *avctx); const AVCRC *crc_ctx;