From: Connor Worley <connorbworley@gmail.com> To: ffmpeg-devel@ffmpeg.org Cc: Connor Worley <connorbworley@gmail.com> Subject: [FFmpeg-devel] [PATCH 1/3] lavc/dxv: move tag definitions to common header Date: Sun, 28 Jan 2024 13:13:33 -0800 Message-ID: <20240128211335.58631-1-connorbworley@gmail.com> (raw) Signed-off-by: Connor Worley <connorbworley@gmail.com> --- 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 <connorbworley@gmail.com> + * + * 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; -- 2.40.1 _______________________________________________ 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".
next reply other threads:[~2024-01-28 21:14 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-01-28 21:13 Connor Worley [this message] 2024-01-28 21:13 ` [FFmpeg-devel] [PATCH 2/3] lavc/dvx: use texdsp funcs for texture block decompression Connor Worley 2024-01-28 21:13 ` [FFmpeg-devel] [PATCH 3/3] lavc/dxv: remove ctx fields that can be derived from texdsp ctxs Connor Worley 2024-01-29 7:54 ` Andreas Rheinhardt 2024-01-29 18:42 ` Connor Worley 2024-02-03 22:17 ` [FFmpeg-devel] [PATCH 1/3] lavc/dxv: move tag definitions to common header Connor Worley
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20240128211335.58631-1-connorbworley@gmail.com \ --to=connorbworley@gmail.com \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git