History

avcodec/hapdec: don't log texture format every frame, do it once per decode session

Tom Butterworth committed 11 years ago

Commit 6b96c701 parent 440c26e1 file · +8 −19Browse files

Unified · Split

libavcodec/hapdec.c+8−19
@@ -74,7 +74,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 73 unmodified lines
7474 HapContext *ctx = avctx->priv_data;
7575 GetByteContext *gbc = &ctx->gbc;
7676 int64_t snappy_size;
77− const char *texture_name;
7877 const char *compressorstr;
7978 int ret;
8079
@@ -83,22 +82,6 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 2 unmodified lines
8382 || (avctx->codec_tag == MKTAG('H','a','p','Y') && (ctx->section_type & 0x0F) != HAP_FMT_YCOCGDXT5))
8483 return AVERROR_INVALIDDATA;
8584
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−
10285 switch (ctx->section_type & 0xF0) {
10386 case HAP_COMP_NONE:
10487 /* Only DXTC texture compression */
@@ -134,8 +117,7 @@ static int setup_texture(AVCodecContext *avctx, size_t length) · 29 unmodified lines
134117 return AVERROR_INVALIDDATA;
135118 }
136119
137− av_log(avctx, AV_LOG_DEBUG, "%s texture with %s compressor\n",
138− texture_name, compressorstr);
120+ av_log(avctx, AV_LOG_DEBUG, "%s compressor\n", compressorstr);
139121
140122 return 0;
141123 }
@@ -198,6 +180,7 @@ static int hap_decode(AVCodecContext *avctx, void *data, · 56 unmodified lines
198180 static av_cold int hap_init(AVCodecContext *avctx)
199181 {
200182 HapContext *ctx = avctx->priv_data;
183+ const char *texture_name;
201184 int ret = av_image_check_size(avctx->width, avctx->height, 0, avctx);
202185
203186 if (ret < 0) {
@@ -217,20 +200,26 @@ static av_cold int hap_init(AVCodecContext *avctx) · 13 unmodified lines
217200
218201 switch (avctx->codec_tag) {
219202 case MKTAG('H','a','p','1'):
203+ texture_name = "DXT1";
220204 ctx->tex_rat = 8;
221205 ctx->tex_fun = ctx->dxtc.dxt1_block;
222206 break;
223207 case MKTAG('H','a','p','5'):
208+ texture_name = "DXT5";
224209 ctx->tex_rat = 16;
225210 ctx->tex_fun = ctx->dxtc.dxt5_block;
226211 break;
227212 case MKTAG('H','a','p','Y'):
213+ texture_name = "DXT5-YCoCg-scaled";
228214 ctx->tex_rat = 16;
229215 ctx->tex_fun = ctx->dxtc.dxt5ys_block;
230216 break;
231217 default:
232218 return AVERROR_DECODER_NOT_FOUND;
233219 }
220+
221+ av_log(avctx, AV_LOG_DEBUG, "%s texture\n", texture_name);
222+
234223 return 0;
235224 }
236225

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t