Unified · Split
| @@ -74,7 +74,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 73 unmodified lines | |||
| 74 | HapContext *ctx = avctx->priv_data; | 74 | HapContext *ctx = avctx->priv_data; |
| 75 | GetByteContext *gbc = &ctx->gbc; | 75 | GetByteContext *gbc = &ctx->gbc; |
| 76 | int64_t snappy_size; | 76 | int64_t snappy_size; |
| 77 | const char *texture_name; | ||
| 78 | const char *compressorstr; | 77 | const char *compressorstr; |
| 79 | int ret; | 78 | int ret; |
| 80 | 79 | ||
| @@ -83,22 +82,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 2 unmodified lines | |||
| 83 | || (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 0x0F) != HAP_FMT_YCOCGDXT5)) | 82 | || (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 0x0F) != HAP_FMT_YCOCGDXT5)) |
| 84 | return AVERROR_INVALIDDATA; | 83 | return AVERROR_INVALIDDATA; |
| 85 | 84 | ||
| 86 | switch (ctx->section_type & 0x0F) { | ||
| 87 | case HAP_FMT_RGBDXT1: | ||
| 88 | texture_name = "DXT1"; | ||
| 89 | break; | ||
| 90 | case HAP_FMT_RGBADXT5: | ||
| 91 | texture_name = "DXT5"; | ||
| 92 | break; | ||
| 93 | case HAP_FMT_YCOCGDXT5: | ||
| 94 | texture_name = "DXT5-YCoCg-scaled"; | ||
| 95 | break; | ||
| 96 | default: | ||
| 97 | av_log(avctx, AV_LOG_ERROR, | ||
| 98 | "Invalid format mode %02X.\n", ctx->section_type); | ||
| 99 | return AVERROR_INVALIDDATA; | ||
| 100 | } | ||
| 101 | |||
| 102 | switch (ctx->section_type & 0xF0) { | 85 | switch (ctx->section_type & 0xF0) { |
| 103 | case HAP_COMP_NONE: | 86 | case HAP_COMP_NONE: |
| 104 | /* Only DXTC texture compression */ | 87 | /* Only DXTC texture compression */ |
| @@ -134,8 +117,7 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 29 unmodified lines | |||
| 134 | return AVERROR_INVALIDDATA; | 117 | return AVERROR_INVALIDDATA; |
| 135 | } | 118 | } |
| 136 | 119 | ||
| 137 | av_log(avctx, AV_LOG_DEBUG, "%s texture with %s compressor\n", | 120 | av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr); |
| 138 | texture_name, compressorstr); | ||
| 139 | 121 | ||
| 140 | return 0; | 122 | return 0; |
| 141 | } | 123 | } |
| @@ -198,6 +180,7 @@ static int hap_decode(AVCodecContext *avctx, void *data, · 56 unmodified lines | |||
| 198 | static av_cold int hap_init(AVCodecContext *avctx) | 180 | static av_cold int hap_init(AVCodecContext *avctx) |
| 199 | { | 181 | { |
| 200 | HapContext *ctx = avctx->priv_data; | 182 | HapContext *ctx = avctx->priv_data; |
| 183 | const char *texture_name; | ||
| 201 | int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx); | 184 | int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx); |
| 202 | 185 | ||
| 203 | if (ret < 0) { | 186 | if (ret < 0) { |
| @@ -217,20 +200,26 @@ static av_cold int hap_init(AVCodecContext *avctx) · 13 unmodified lines | |||
| 217 | 200 | ||
| 218 | switch (avctx->codec_tag) { | 201 | switch (avctx->codec_tag) { |
| 219 | case MKTAG('H','a','p','1'): | 202 | case MKTAG('H','a','p','1'): |
| 203 | texture_name = "DXT1"; | ||
| 220 | ctx->tex_rat = 8; | 204 | ctx->tex_rat = 8; |
| 221 | ctx->tex_fun = ctx->dxtc.dxt1_block; | 205 | ctx->tex_fun = ctx->dxtc.dxt1_block; |
| 222 | break; | 206 | break; |
| 223 | case MKTAG('H','a','p','5'): | 207 | case MKTAG('H','a','p','5'): |
| 208 | texture_name = "DXT5"; | ||
| 224 | ctx->tex_rat = 16; | 209 | ctx->tex_rat = 16; |
| 225 | ctx->tex_fun = ctx->dxtc.dxt5_block; | 210 | ctx->tex_fun = ctx->dxtc.dxt5_block; |
| 226 | break; | 211 | break; |
| 227 | case MKTAG('H','a','p','Y'): | 212 | case MKTAG('H','a','p','Y'): |
| 213 | texture_name = "DXT5-YCoCg-scaled"; | ||
| 228 | ctx->tex_rat = 16; | 214 | ctx->tex_rat = 16; |
| 229 | ctx->tex_fun = ctx->dxtc.dxt5ys_block; | 215 | ctx->tex_fun = ctx->dxtc.dxt5ys_block; |
| 230 | break; | 216 | break; |
| 231 | default: | 217 | default: |
| 232 | return AVERROR_DECODER_NOT_FOUND; | 218 | return AVERROR_DECODER_NOT_FOUND; |
| 233 | } | 219 | } |
| 220 | |||
| 221 | av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name); | ||
| 222 | |||
| 234 | return 0; | 223 | return 0; |
| 235 | } | 224 | } |
| 236 | 225 | ||