Commit f3bdc3da authored by Reimar Döffinger's avatar Reimar Döffinger Committed by Carl Eugen Hoyos

Call ff_find_hwaccel() after calling avcodec_set_dimensions().

Patch by Reimar

Originally committed as revision 20599 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 8b4a6d47
......@@ -2198,8 +2198,6 @@ static av_cold int decode_init(AVCodecContext *avctx){
if(!avctx->has_b_frames)
s->low_delay= 1;
avctx->pix_fmt= avctx->get_format(avctx, avctx->codec->pix_fmts);
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
decode_init_vlc();
......@@ -3809,6 +3807,22 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
if (!s->context_initialized) {
if(h != h0)
return -1; // we cant (re-)initialize context during parallel decoding
avcodec_set_dimensions(s->avctx, s->width, s->height);
s->avctx->sample_aspect_ratio= h->sps.sar;
if(!s->avctx->sample_aspect_ratio.den)
s->avctx->sample_aspect_ratio.den = 1;
if(h->sps.timing_info_present_flag){
s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
if(h->x264_build > 0 && h->x264_build < 44)
s->avctx->time_base.den *= 2;
av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
}
s->avctx->pix_fmt = s->avctx->get_format(s->avctx, s->avctx->codec->pix_fmts);
s->avctx->hwaccel = ff_find_hwaccel(s->avctx->codec->id, s->avctx->pix_fmt);
if (MPV_common_init(s) < 0)
return -1;
s->first_field = 0;
......@@ -3831,19 +3845,6 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
for(i = 0; i < s->avctx->thread_count; i++)
if(context_init(h->thread_context[i]) < 0)
return -1;
avcodec_set_dimensions(s->avctx, s->width, s->height);
s->avctx->sample_aspect_ratio= h->sps.sar;
if(!s->avctx->sample_aspect_ratio.den)
s->avctx->sample_aspect_ratio.den = 1;
if(h->sps.timing_info_present_flag){
s->avctx->time_base= (AVRational){h->sps.num_units_in_tick, h->sps.time_scale};
if(h->x264_build > 0 && h->x264_build < 44)
s->avctx->time_base.den *= 2;
av_reduce(&s->avctx->time_base.num, &s->avctx->time_base.den,
s->avctx->time_base.num, s->avctx->time_base.den, 1<<30);
}
}
h->frame_num= get_bits(&s->gb, h->sps.log2_max_frame_num);
......
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