Go to the documentation of this file.
30 #define TXD_DXT1 0x31545844
31 #define TXD_DXT3 0x33545844
51 version = bytestream2_get_le32(&gb);
54 w = bytestream2_get_le16(&gb);
55 h = bytestream2_get_le16(&gb);
56 depth = bytestream2_get_byte(&gb);
58 flags = bytestream2_get_byte(&gb);
60 if (version < 8 || version > 9) {
69 }
else if (depth == 16) {
83 }
else if (depth == 32) {
107 pal = (uint32_t *) p->
data[1];
108 for (y = 0; y < 256; y++) {
109 v = bytestream2_get_be32(&gb);
110 pal[y] = (v >> 8) + (v << 24);
113 for (y=0; y<
h; y++) {
117 }
else if (depth == 16) {
122 for (j = 0; j < avctx->
height; j += 4) {
123 for (
i = 0;
i < avctx->
width;
i += 4) {
124 uint8_t *p = ptr +
i * 4 + j *
stride;
131 for (j = 0; j < avctx->
height; j += 4) {
132 for (
i = 0;
i < avctx->
width;
i += 4) {
133 uint8_t *p = ptr +
i * 4 + j *
stride;
142 }
else if (depth == 32) {
146 for (y=0; y<
h; y++) {
int(* dxt1_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
This structure describes decoded (raw) audio or video data.
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
AVCodec p
The public AVCodec.
static int txd_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
#define FF_CODEC_DECODE_CB(func)
#define AV_CEIL_RSHIFT(a, b)
av_cold void ff_texturedsp_init(TextureDSPContext *c)
#define CODEC_LONG_NAME(str)
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
@ AV_PICTURE_TYPE_I
Intra.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
#define i(width, name, range_min, range_max)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const FFCodec ff_txd_decoder
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
int(* dxt3_block)(uint8_t *dst, ptrdiff_t stride, const uint8_t *block)
int coded_width
Bitstream width / height, may be different from width/height e.g.
static int unsupported(AVCodecContext *avctx)
This structure stores compressed data.
int width
picture width / height.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define flags(name, subs,...)
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
#define AVERROR_INVALIDDATA
Invalid data found when processing input.