Commit 8337e0c5 authored by Vittorio Giovara's avatar Vittorio Giovara

Introduce a TextureDSP module

This module implements generic texture decompression from different
families (DXTC, RGTC, BCn) and texture compression DXTC 1, 3, and 5.
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 2ecfd451
...@@ -1626,6 +1626,8 @@ CONFIG_EXTRA=" ...@@ -1626,6 +1626,8 @@ CONFIG_EXTRA="
sinewin sinewin
snappy snappy
startcode startcode
texturedsp
texturedspenc
tpeldsp tpeldsp
videodsp videodsp
vp3dsp vp3dsp
......
...@@ -93,6 +93,8 @@ OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes) ...@@ -93,6 +93,8 @@ OBJS-$(CONFIG_RDFT) += rdft.o $(RDFT-OBJS-yes)
OBJS-$(CONFIG_SINEWIN) += sinewin.o OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_SNAPPY) += snappy.o OBJS-$(CONFIG_SNAPPY) += snappy.o
OBJS-$(CONFIG_STARTCODE) += startcode.o OBJS-$(CONFIG_STARTCODE) += startcode.o
OBJS-$(CONFIG_TEXTUREDSP) += texturedsp.o
OBJS-$(CONFIG_TEXTUREDSPENC) += texturedspenc.o
OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
OBJS-$(CONFIG_VIDEODSP) += videodsp.o OBJS-$(CONFIG_VIDEODSP) += videodsp.o
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
......
This diff is collapsed.
/*
* Texture block module
* Copyright (C) 2015 Vittorio Giovara <vittorio.giovara@gmail.com>
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* Texture block (4x4) module
*
* References:
* https://www.opengl.org/wiki/S3_Texture_Compression
* https://www.opengl.org/wiki/Red_Green_Texture_Compression
* https://msdn.microsoft.com/en-us/library/bb694531%28v=vs.85%29.aspx
*
* All functions return how much data has been written or read.
*
* Pixel input or output format is always AV_PIX_FMT_RGBA.
*/
#ifndef AVCODEC_TEXTUREDSP_H
#define AVCODEC_TEXTUREDSP_H
#include <stddef.h>
#include <stdint.h>
#define TEXTURE_BLOCK_W 4
#define TEXTURE_BLOCK_H 4
typedef struct TextureDSPContext {
int (*dxt1_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt1a_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt2_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt3_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt4_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt5_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt5y_block) (uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxt5ys_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*rgtc1s_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*rgtc1u_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*rgtc2s_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*rgtc2u_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
int (*dxn3dc_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block);
} TextureDSPContext;
void ff_texturedsp_init(TextureDSPContext *c);
void ff_texturedspenc_init(TextureDSPContext *c);
#endif /* AVCODEC_TEXTUREDSP_H */
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment