diff options
author | Tom Butterworth <bangnoise@gmail.com> | 2015-07-21 03:12:10 +0300 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-07-21 04:25:01 +0300 |
commit | 6b96c70f2d8948ccc64cdac35ead4e470c253173 (patch) | |
tree | 446c71ce7c0402ee87f0043b3bc6ad1fee627dc6 /libavcodec | |
parent | 440c26e9c46bb26bc1fc8306561ed6962ae7d3bf (diff) |
avcodec/hapdec: don't log texture format every frame, do it once per decode session
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/hapdec.c | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/libavcodec/hapdec.c b/libavcodec/hapdec.c index 7eff9e0273..f55d4b77dc 100644 --- a/libavcodec/hapdec.c +++ b/libavcodec/hapdec.c @@ -74,7 +74,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) HapContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; int64_t snappy_size; - const char *texture_name; const char *compressorstr; int ret; @@ -83,22 +82,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) || (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 0x0F) != HAP_FMT_YCOCGDXT5)) return AVERROR_INVALIDDATA; - switch (ctx->section_type & 0x0F) { - case HAP_FMT_RGBDXT1: - texture_name = "DXT1"; - break; - case HAP_FMT_RGBADXT5: - texture_name = "DXT5"; - break; - case HAP_FMT_YCOCGDXT5: - texture_name = "DXT5-YCoCg-scaled"; - break; - default: - av_log(avctx, AV_LOG_ERROR, - "Invalid format mode %02X.\n", ctx->section_type); - return AVERROR_INVALIDDATA; - } - switch (ctx->section_type & 0xF0) { case HAP_COMP_NONE: /* Only DXTC texture compression */ @@ -134,8 +117,7 @@ static int setup_texture(AVCodecContext *avctx, size_t length) return AVERROR_INVALIDDATA; } - av_log(avctx, AV_LOG_DEBUG, "%s texture with %s compressor\n", - texture_name, compressorstr); + av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr); return 0; } @@ -198,6 +180,7 @@ static int hap_decode(AVCodecContext *avctx, void *data, static av_cold int hap_init(AVCodecContext *avctx) { HapContext *ctx = avctx->priv_data; + const char *texture_name; int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx); if (ret < 0) { @@ -217,20 +200,26 @@ static av_cold int hap_init(AVCodecContext *avctx) switch (avctx->codec_tag) { case MKTAG('H','a','p','1'): + texture_name = "DXT1"; ctx->tex_rat = 8; ctx->tex_fun = ctx->dxtc.dxt1_block; break; case MKTAG('H','a','p','5'): + texture_name = "DXT5"; ctx->tex_rat = 16; ctx->tex_fun = ctx->dxtc.dxt5_block; break; case MKTAG('H','a','p','Y'): + texture_name = "DXT5-YCoCg-scaled"; ctx->tex_rat = 16; ctx->tex_fun = ctx->dxtc.dxt5ys_block; break; default: return AVERROR_DECODER_NOT_FOUND; } + + av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name); + return 0; } |