aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-09-26 11:14:25 +0200
committerHendrik Leppkes <h.leppkes@gmail.com>2015-09-26 11:14:25 +0200
commitb4ea8a7305214c0460e0ac951135aafcfa99d9e5 (patch)
treea4fa71e75d469b57dbfd9f16f6b59e63d1beb2b7 /libavcodec
parentf6048e4920de96f5ddf3a149638e0ffbb055ef8a (diff)
parent1bcd4a476ba45a7fdf59d1701b8f0e274418cc32 (diff)
downloadffmpeg-b4ea8a7305214c0460e0ac951135aafcfa99d9e5.tar.gz
Merge commit '1bcd4a476ba45a7fdf59d1701b8f0e274418cc32'
* commit '1bcd4a476ba45a7fdf59d1701b8f0e274418cc32': dxv: Support RAW intermediate compression Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/dxv.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index 76b3054fef..d0a79f4a6d 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -314,6 +314,15 @@ static int dxv_decompress_lzf(AVCodecContext *avctx)
return ff_lzf_uncompress(&ctx->gbc, &ctx->tex_data, &ctx->tex_size);
}
+static int dxv_decompress_raw(AVCodecContext *avctx)
+{
+ DXVContext *ctx = avctx->priv_data;
+ GetByteContext *gbc = &ctx->gbc;
+
+ bytestream2_get_buffer(gbc, ctx->tex_data, ctx->tex_size);
+ return 0;
+}
+
static int dxv_decode(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
@@ -356,7 +365,14 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
size = tag & 0x00FFFFFF;
old_type = tag >> 24;
version_major = (old_type & 0x0F) - 1;
- msgcomp = "LZF";
+
+ if (old_type & 0x80) {
+ msgcomp = "RAW";
+ decompress_tex = dxv_decompress_raw;
+ } else {
+ msgcomp = "LZF";
+ decompress_tex = dxv_decompress_lzf;
+ }
if (old_type & 0x40) {
msgtext = "DXT5";
@@ -372,7 +388,6 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "Unsupported header (0x%08X)\n.", tag);
return AVERROR_INVALIDDATA;
}
- decompress_tex = dxv_decompress_lzf;
ctx->tex_rat = 1;
break;
}
@@ -382,7 +397,14 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
version_major = bytestream2_get_byte(gbc) - 1;
version_minor = bytestream2_get_byte(gbc);
- bytestream2_skip(gbc, 2); // unknown
+ /* Encoder copies texture data when compression is not advantageous. */
+ if (bytestream2_get_byte(gbc)) {
+ msgcomp = "RAW";
+ ctx->tex_rat = 1;
+ decompress_tex = dxv_decompress_raw;
+ }
+
+ bytestream2_skip(gbc, 1); // unknown
size = bytestream2_get_le32(gbc);
}
av_log(avctx, AV_LOG_DEBUG,