From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 88399475AE for ; Sat, 10 Feb 2024 22:59:06 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B11ED68D081; Sun, 11 Feb 2024 00:59:04 +0200 (EET) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 19DFC6800C1 for ; Sun, 11 Feb 2024 00:58:58 +0200 (EET) Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1d746ce7d13so18041105ad.0 for ; Sat, 10 Feb 2024 14:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707605935; x=1708210735; 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=GOSotXSW2ky0teL7VKMLR3nCE3GWmTCufnoHEMcNVso=; b=V1yOcnsvQ3fU2eywI/ktIhlPcxiZxBQZItlseywmfF+p/1LXqY1WN0NesRyuTj95B9 N/kxBC+uiMEZRaDmRSE71jyfwOgCyDmmPp0mCIfPcFlxrIsYI1TRlh63TQlHVv6DPbBe oWqwVdFghHmzXnVgItW/uHvY58qv52zoVmeXbULHDCesr3OTNCmF5mhruMGLgZX060zM 5KnL/uF0V/yEUggpvgYhvwjfVNvd+i6TNrW8OjARbB9Za7OInNBUgaE3+KFfBvB2JhZR 4N/eItlkrWma4nMjDaHX+0PuWKW1PlDwGoUGMyGY5NiUAnXz/AaqmAoZpVTSGXRdQMEX 9VqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707605935; x=1708210735; 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=GOSotXSW2ky0teL7VKMLR3nCE3GWmTCufnoHEMcNVso=; b=ljiVMvnXDfVCr28R1Ld0+RgJ9D9xJClGOUiDlYYkTk0rHiKP/roORQ1Wsry3P9Txx/ OBtiE5mChrOtPCWfWFM/6BlV9FQW1Msc/7r7v+/z23dZaRSxRpKpBNyCs+sqby1zhEF0 11TiUWpbdx28AY9vR2cUAEowc0ziZoLK7g2I48kUOnA75IjUI71puW0r2R2cKRmedoHe ketGy28QSNxI4v6TSTZvWq0UwLTlCDjesJpnTfQoyB0XqQu39hkSh2mu3AmBjHDmeqBk 48vsSy3jnU1hWd/ismo86rb4nr5lymoIBEfjDVYTqzx24Fj6MJDnRpzes6ElLn4oedhG 0EvA== X-Gm-Message-State: AOJu0Ywx/GDhPJp4FZFs+960u1WKRxqClxKc7UkfHehrXz9GwdcC802b TzLkTkSs9dyXNEvB6KQvVkc0rrNnnlNfBKe2Jug0cFujhOAnYLCo+COMmd6n X-Google-Smtp-Source: AGHT+IHAXZo0LG+RsjT7xpIKWOKHyODLHLIvfYvKWdodS/Dc0UGagSxJHRCmtEJMiYmKXql+pTbzig== X-Received: by 2002:a17:902:e5ca:b0:1d9:a5ec:30d2 with SMTP id u10-20020a170902e5ca00b001d9a5ec30d2mr4186672plf.12.1707605934685; Sat, 10 Feb 2024 14:58:54 -0800 (PST) Received: from localhost (192-184-169-201.fiber.dynamic.sonic.net. [192.184.169.201]) by smtp.gmail.com with UTF8SMTPSA id kd5-20020a17090313c500b001d8ffe741basm3526890plb.36.2024.02.10.14.58.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 10 Feb 2024 14:58:54 -0800 (PST) From: Connor Worley To: ffmpeg-devel@ffmpeg.org Date: Sat, 10 Feb 2024 14:58:45 -0800 Message-ID: <20240210225847.53228-1-connorbworley@gmail.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 9261a5cac1..16c34fff3b 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; /* DXV misnomers DXT5, alpha is premultiplied so use DXT4 instead */ ctx->tex_funct = ctx->texdsp.dxt4_block; @@ -1081,7 +1082,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; @@ -1098,7 +1099,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 33a18d53d8..bb2c2f8526 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; -- 2.43.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".