Commit 5b73ba98 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpeg12dec: Add FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM

This decreases the amount of computations and memory needed for analysing mpeg1/2 streams

the properties update is moved from code that is skiped if skip_frame is set
to code that is not skiped so the change doesnt loose that
from being executed
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 65e33d8e
...@@ -1655,7 +1655,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) ...@@ -1655,7 +1655,6 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
if (sd) if (sd)
memcpy(sd->data, s1->a53_caption, s1->a53_caption_size); memcpy(sd->data, s1->a53_caption, s1->a53_caption_size);
av_freep(&s1->a53_caption); av_freep(&s1->a53_caption);
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
} }
if (s1->has_stereo3d) { if (s1->has_stereo3d) {
...@@ -2258,6 +2257,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, ...@@ -2258,6 +2257,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
s1->a53_caption = av_malloc(s1->a53_caption_size); s1->a53_caption = av_malloc(s1->a53_caption_size);
if (s1->a53_caption) if (s1->a53_caption)
memcpy(s1->a53_caption, p + 7, s1->a53_caption_size); memcpy(s1->a53_caption, p + 7, s1->a53_caption_size);
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
} }
return 1; return 1;
} else if (buf_size >= 11 && } else if (buf_size >= 11 &&
...@@ -2313,6 +2313,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx, ...@@ -2313,6 +2313,7 @@ static int mpeg_decode_a53_cc(AVCodecContext *avctx,
p += 6; p += 6;
} }
} }
avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS;
} }
return 1; return 1;
} }
...@@ -2868,6 +2869,7 @@ AVCodec ff_mpeg1video_decoder = { ...@@ -2868,6 +2869,7 @@ AVCodec ff_mpeg1video_decoder = {
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SLICE_THREADS, AV_CODEC_CAP_SLICE_THREADS,
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
.flush = flush, .flush = flush,
.max_lowres = 3, .max_lowres = 3,
.update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context) .update_thread_context = ONLY_IF_THREADS_ENABLED(mpeg_decode_update_thread_context)
...@@ -2885,6 +2887,7 @@ AVCodec ff_mpeg2video_decoder = { ...@@ -2885,6 +2887,7 @@ AVCodec ff_mpeg2video_decoder = {
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 |
AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY |
AV_CODEC_CAP_SLICE_THREADS, AV_CODEC_CAP_SLICE_THREADS,
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
.flush = flush, .flush = flush,
.max_lowres = 3, .max_lowres = 3,
.profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles), .profiles = NULL_IF_CONFIG_SMALL(ff_mpeg2_video_profiles),
...@@ -2901,6 +2904,7 @@ AVCodec ff_mpegvideo_decoder = { ...@@ -2901,6 +2904,7 @@ AVCodec ff_mpegvideo_decoder = {
.close = mpeg_decode_end, .close = mpeg_decode_end,
.decode = mpeg_decode_frame, .decode = mpeg_decode_frame,
.capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS, .capabilities = AV_CODEC_CAP_DRAW_HORIZ_BAND | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_TRUNCATED | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_SLICE_THREADS,
.caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
.flush = flush, .flush = flush,
.max_lowres = 3, .max_lowres = 3,
}; };
......
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