lavc/dxv: move tag definitions to common header

Signed-off-by: Connor Worley <connorbworley@gmail.com>
This commit is contained in:
Connor Worley 2024-02-10 14:58:45 -08:00 committed by Lynne
parent 5e2b0862eb
commit 939bf30d82
3 changed files with 41 additions and 9 deletions

View File

@ -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;

34
libavcodec/dxv.h Normal file
View File

@ -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 */

View File

@ -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;