Commit 1117d6f4 authored by Derek Buitenhuis's avatar Derek Buitenhuis

Merge commit '6202e2fe'

* commit '6202e2fe':
  indeo4: Rework stream analysis report
Merged-by: 's avatarDerek Buitenhuis <derek.buitenhuis@gmail.com>
parents 98e3153f 6202e2fe
...@@ -119,17 +119,13 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx) ...@@ -119,17 +119,13 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
#if IVI4_STREAM_ANALYSER
if (ctx->frame_type == IVI4_FRAMETYPE_BIDIR) if (ctx->frame_type == IVI4_FRAMETYPE_BIDIR)
ctx->has_b_frames = 1; ctx->has_b_frames = 1;
#endif
ctx->transp_status = get_bits1(&ctx->gb); ctx->transp_status = get_bits1(&ctx->gb);
#if IVI4_STREAM_ANALYSER
if (ctx->transp_status) { if (ctx->transp_status) {
ctx->has_transp = 1; ctx->has_transp = 1;
} }
#endif
/* unknown bit: Mac decoder ignores this bit, XANIM returns error */ /* unknown bit: Mac decoder ignores this bit, XANIM returns error */
if (get_bits1(&ctx->gb)) { if (get_bits1(&ctx->gb)) {
...@@ -166,9 +162,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx) ...@@ -166,9 +162,7 @@ static int decode_pic_hdr(IVI45DecContext *ctx, AVCodecContext *avctx)
if (get_bits1(&ctx->gb)) { if (get_bits1(&ctx->gb)) {
pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, get_bits(&ctx->gb, 4)); pic_conf.tile_height = scale_tile_size(pic_conf.pic_height, get_bits(&ctx->gb, 4));
pic_conf.tile_width = scale_tile_size(pic_conf.pic_width, get_bits(&ctx->gb, 4)); pic_conf.tile_width = scale_tile_size(pic_conf.pic_width, get_bits(&ctx->gb, 4));
#if IVI4_STREAM_ANALYSER
ctx->uses_tiling = 1; ctx->uses_tiling = 1;
#endif
} else { } else {
pic_conf.tile_height = pic_conf.pic_height; pic_conf.tile_height = pic_conf.pic_height;
pic_conf.tile_width = pic_conf.pic_width; pic_conf.tile_width = pic_conf.pic_width;
...@@ -295,10 +289,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, ...@@ -295,10 +289,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
band->is_halfpel); band->is_halfpel);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
#if IVI4_STREAM_ANALYSER
if (!band->is_halfpel) if (!band->is_halfpel)
ctx->uses_fullpel = 1; ctx->uses_fullpel = 1;
#endif
band->checksum_present = get_bits1(&ctx->gb); band->checksum_present = get_bits1(&ctx->gb);
if (band->checksum_present) if (band->checksum_present)
...@@ -334,10 +326,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band, ...@@ -334,10 +326,8 @@ static int decode_band_hdr(IVI45DecContext *ctx, IVIBandDesc *band,
av_log(avctx, AV_LOG_ERROR, "wrong transform size!\n"); av_log(avctx, AV_LOG_ERROR, "wrong transform size!\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
#if IVI4_STREAM_ANALYSER
if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10) if ((transform_id >= 0 && transform_id <= 2) || transform_id == 10)
ctx->uses_haar = 1; ctx->uses_haar = 1;
#endif
band->inv_transform = transforms[transform_id].inv_trans; band->inv_transform = transforms[transform_id].inv_trans;
band->dc_transform = transforms[transform_id].dc_trans; band->dc_transform = transforms[transform_id].dc_trans;
...@@ -683,6 +673,7 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -683,6 +673,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->is_nonnull_frame = is_nonnull_frame; ctx->is_nonnull_frame = is_nonnull_frame;
ctx->is_indeo4 = 1; ctx->is_indeo4 = 1;
ctx->show_indeo4_info = 1;
ctx->dst_buf = 0; ctx->dst_buf = 0;
ctx->ref_buf = 1; ctx->ref_buf = 1;
......
...@@ -1172,6 +1172,22 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -1172,6 +1172,22 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} }
} }
if (ctx->show_indeo4_info) {
if (ctx->is_scalable)
av_log(avctx, AV_LOG_DEBUG, "This video uses scalability mode\n");
if (ctx->uses_tiling)
av_log(avctx, AV_LOG_DEBUG, "This video uses local decoding\n");
if (ctx->has_b_frames)
av_log(avctx, AV_LOG_DEBUG, "This video contains B-frames\n");
if (ctx->has_transp)
av_log(avctx, AV_LOG_DEBUG, "Transparency mode is enabled\n");
if (ctx->uses_haar)
av_log(avctx, AV_LOG_DEBUG, "This video uses Haar transform\n");
if (ctx->uses_fullpel)
av_log(avctx, AV_LOG_DEBUG, "This video uses fullpel motion vectors\n");
ctx->show_indeo4_info = 0;
}
return buf_size; return buf_size;
} }
...@@ -1187,23 +1203,6 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx) ...@@ -1187,23 +1203,6 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
if (ctx->mb_vlc.cust_tab.table) if (ctx->mb_vlc.cust_tab.table)
ff_free_vlc(&ctx->mb_vlc.cust_tab); ff_free_vlc(&ctx->mb_vlc.cust_tab);
#if IVI4_STREAM_ANALYSER
if (ctx->is_indeo4) {
if (ctx->is_scalable)
av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n");
if (ctx->uses_tiling)
av_log(avctx, AV_LOG_ERROR, "This video uses local decoding!\n");
if (ctx->has_b_frames)
av_log(avctx, AV_LOG_ERROR, "This video contains B-frames!\n");
if (ctx->has_transp)
av_log(avctx, AV_LOG_ERROR, "Transparency mode is enabled!\n");
if (ctx->uses_haar)
av_log(avctx, AV_LOG_ERROR, "This video uses Haar transform!\n");
if (ctx->uses_fullpel)
av_log(avctx, AV_LOG_ERROR, "This video uses fullpel motion vectors!\n");
}
#endif
av_frame_free(&ctx->p_frame); av_frame_free(&ctx->p_frame);
return 0; return 0;
......
...@@ -47,7 +47,6 @@ enum { ...@@ -47,7 +47,6 @@ enum {
}; };
#define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes #define IVI_VLC_BITS 13 ///< max number of bits of the ivi's huffman codes
#define IVI4_STREAM_ANALYSER 0
#define IVI5_IS_PROTECTED 0x20 #define IVI5_IS_PROTECTED 0x20
/** /**
...@@ -250,13 +249,12 @@ typedef struct IVI45DecContext { ...@@ -250,13 +249,12 @@ typedef struct IVI45DecContext {
uint8_t gop_flags; uint8_t gop_flags;
uint32_t lock_word; uint32_t lock_word;
#if IVI4_STREAM_ANALYSER int show_indeo4_info;
uint8_t has_b_frames; uint8_t has_b_frames;
uint8_t has_transp; uint8_t has_transp;
uint8_t uses_tiling; uint8_t uses_tiling;
uint8_t uses_haar; uint8_t uses_haar;
uint8_t uses_fullpel; uint8_t uses_fullpel;
#endif
int (*decode_pic_hdr) (struct IVI45DecContext *ctx, AVCodecContext *avctx); int (*decode_pic_hdr) (struct IVI45DecContext *ctx, AVCodecContext *avctx);
int (*decode_band_hdr) (struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx); int (*decode_band_hdr) (struct IVI45DecContext *ctx, IVIBandDesc *band, AVCodecContext *avctx);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment