summaryrefslogtreecommitdiff
path: root/libavcodec/hapdec.c
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2017-11-25 19:46:48 +0100
committerMartin Vignali <martin.vignali@gmail.com>2017-11-25 19:49:30 +0100
commit21c06c4095f53b2c343e1225ae52d83160e213f1 (patch)
tree5ced7f4228f9d444a4f656d3bae0859c53d4b4bf /libavcodec/hapdec.c
parent07e427aa56550bed2e2b7b401b4f4b3800e74217 (diff)
downloadffmpeg-21c06c4095f53b2c343e1225ae52d83160e213f1.tar.gz
avcodec/hapdec : use gray8 for HapAlphaOnly decoding instead of RGB0
Diffstat (limited to 'libavcodec/hapdec.c')
-rw-r--r--libavcodec/hapdec.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c
index a1abb3285f..8fd4aa962c 100644
--- a/libavcodec/hapdec.c
+++ b/libavcodec/hapdec.c
@@ -300,10 +300,10 @@ static int decompress_texture_thread_internal(AVCodecContext *avctx, void *arg,
int off = y * w_block;
for (x = 0; x < w_block; x++) {
if (texture_num == 0) {
- ctx->tex_fun(p + x * 16, frame->linesize[0],
+ ctx->tex_fun(p + x * 4 * ctx->uncompress_pix_size, frame->linesize[0],
d + (off + x) * ctx->tex_rat);
} else {
- ctx->tex_fun2(p + x * 16, frame->linesize[0],
+ ctx->tex_fun2(p + x * 4 * ctx->uncompress_pix_size, frame->linesize[0],
d + (off + x) * ctx->tex_rat2);
}
}
@@ -438,6 +438,7 @@ static av_cold int hap_init(AVCodecContext *avctx)
ff_texturedsp_init(&ctx->dxtc);
ctx->texture_count = 1;
+ ctx->uncompress_pix_size = 4;
switch (avctx->codec_tag) {
case MKTAG('H','a','p','1'):
@@ -461,8 +462,9 @@ static av_cold int hap_init(AVCodecContext *avctx)
case MKTAG('H','a','p','A'):
texture_name = "RGTC1";
ctx->tex_rat = 8;
- ctx->tex_fun = ctx->dxtc.rgtc1u_block;
- avctx->pix_fmt = AV_PIX_FMT_RGB0;
+ ctx->tex_fun = ctx->dxtc.rgtc1u_gray_block;
+ avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+ ctx->uncompress_pix_size = 1;
break;
case MKTAG('H','a','p','M'):
texture_name = "DXT5-YCoCg-scaled / RGTC1";