Commit e121ac63 authored by Dirk Ausserhaus's avatar Dirk Ausserhaus Committed by Kostya Shishkov

indeo45: use is_indeo4 context flag instead of checking codec ID

Signed-off-by: 's avatarKostya Shishkov <kostya.shishkov@gmail.com>
parent c67b449b
...@@ -620,6 +620,8 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -620,6 +620,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->switch_buffers = switch_buffers; ctx->switch_buffers = switch_buffers;
ctx->is_nonnull_frame = is_nonnull_frame; ctx->is_nonnull_frame = is_nonnull_frame;
ctx->is_indeo4 = 1;
ctx->p_frame = av_frame_alloc(); ctx->p_frame = av_frame_alloc();
if (!ctx->p_frame) if (!ctx->p_frame)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
...@@ -640,6 +640,8 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -640,6 +640,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
ctx->switch_buffers = switch_buffers; ctx->switch_buffers = switch_buffers;
ctx->is_nonnull_frame = is_nonnull_frame; ctx->is_nonnull_frame = is_nonnull_frame;
ctx->is_indeo4 = 0;
avctx->pix_fmt = AV_PIX_FMT_YUV410P; avctx->pix_fmt = AV_PIX_FMT_YUV410P;
return 0; return 0;
......
...@@ -968,8 +968,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -968,8 +968,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
if (ctx->gop_invalid) if (ctx->gop_invalid)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (avctx->codec_id == AV_CODEC_ID_INDEO4 && if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_NULL_LAST) {
ctx->frame_type == IVI4_FRAMETYPE_NULL_LAST) {
if (ctx->got_p_frame) { if (ctx->got_p_frame) {
av_frame_move_ref(data, ctx->p_frame); av_frame_move_ref(data, ctx->p_frame);
*got_frame = 1; *got_frame = 1;
...@@ -1027,7 +1026,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -1027,7 +1026,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} }
if (ctx->is_scalable) { if (ctx->is_scalable) {
if (avctx->codec_id == AV_CODEC_ID_INDEO4) if (ctx->is_indeo4)
ff_ivi_recompose_haar(&ctx->planes[0], frame->data[0], frame->linesize[0]); ff_ivi_recompose_haar(&ctx->planes[0], frame->data[0], frame->linesize[0]);
else else
ff_ivi_recompose53 (&ctx->planes[0], frame->data[0], frame->linesize[0]); ff_ivi_recompose53 (&ctx->planes[0], frame->data[0], frame->linesize[0]);
...@@ -1045,8 +1044,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -1045,8 +1044,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
* to be the only way to handle the B-frames mode. * to be the only way to handle the B-frames mode.
* That's exactly the same Intel decoders do. * That's exactly the same Intel decoders do.
*/ */
if (avctx->codec_id == AV_CODEC_ID_INDEO4 && if (ctx->is_indeo4 && ctx->frame_type == IVI4_FRAMETYPE_INTRA) {
ctx->frame_type == IVI4_FRAMETYPE_INTRA) {
int left; int left;
while (get_bits(&ctx->gb, 8)); // skip version string while (get_bits(&ctx->gb, 8)); // skip version string
...@@ -1077,7 +1075,7 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx) ...@@ -1077,7 +1075,7 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx)
ff_free_vlc(&ctx->mb_vlc.cust_tab); ff_free_vlc(&ctx->mb_vlc.cust_tab);
#if IVI4_STREAM_ANALYSER #if IVI4_STREAM_ANALYSER
if (avctx->codec_id == AV_CODEC_ID_INDEO4) { if (ctx->is_indeo4) {
if (ctx->is_scalable) if (ctx->is_scalable)
av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n"); av_log(avctx, AV_LOG_ERROR, "This video uses scalability mode!\n");
if (ctx->uses_tiling) if (ctx->uses_tiling)
......
...@@ -261,6 +261,8 @@ typedef struct IVI45DecContext { ...@@ -261,6 +261,8 @@ typedef struct IVI45DecContext {
int gop_invalid; int gop_invalid;
int is_indeo4;
AVFrame *p_frame; AVFrame *p_frame;
int got_p_frame; int got_p_frame;
} IVI45DecContext; } IVI45DecContext;
......
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