Commit 4e20b917 authored by cehoyos's avatar cehoyos

Set VDPAU H264 picture parameter field_order_cnt and frame_num at the

start of decoding a picture instead of at the end.
Fixes mmco01.264

Patch by Stephen Warren


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22728 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 72bf5032
...@@ -2577,9 +2577,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){ ...@@ -2577,9 +2577,11 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
avctx->profile = hx->sps.profile_idc; avctx->profile = hx->sps.profile_idc;
avctx->level = hx->sps.level_idc; avctx->level = hx->sps.level_idc;
if (s->avctx->hwaccel && h->current_slice == 1) { if (h->current_slice == 1) {
if (s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0) if (s->avctx->hwaccel && s->avctx->hwaccel->start_frame(s->avctx, NULL, 0) < 0)
return -1; return -1;
if(CONFIG_H264_VDPAU_DECODER && s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU)
ff_vdpau_h264_picture_start(s);
} }
s->current_picture_ptr->key_frame |= s->current_picture_ptr->key_frame |=
......
...@@ -127,7 +127,7 @@ void ff_vdpau_add_data_chunk(MpegEncContext *s, ...@@ -127,7 +127,7 @@ void ff_vdpau_add_data_chunk(MpegEncContext *s,
render->bitstream_buffers_used++; render->bitstream_buffers_used++;
} }
void ff_vdpau_h264_picture_complete(MpegEncContext *s) void ff_vdpau_h264_picture_start(MpegEncContext *s)
{ {
H264Context *h = s->avctx->priv_data; H264Context *h = s->avctx->priv_data;
struct vdpau_render_state *render; struct vdpau_render_state *render;
...@@ -136,10 +136,6 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s) ...@@ -136,10 +136,6 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s)
render = (struct vdpau_render_state *)s->current_picture_ptr->data[0]; render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
assert(render); assert(render);
render->info.h264.slice_count = h->slice_num;
if (render->info.h264.slice_count < 1)
return;
for (i = 0; i < 2; ++i) { for (i = 0; i < 2; ++i) {
int foc = s->current_picture_ptr->field_poc[i]; int foc = s->current_picture_ptr->field_poc[i];
if (foc == INT_MAX) if (foc == INT_MAX)
...@@ -147,8 +143,22 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s) ...@@ -147,8 +143,22 @@ void ff_vdpau_h264_picture_complete(MpegEncContext *s)
render->info.h264.field_order_cnt[i] = foc; render->info.h264.field_order_cnt[i] = foc;
} }
render->info.h264.is_reference = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE;
render->info.h264.frame_num = h->frame_num; render->info.h264.frame_num = h->frame_num;
}
void ff_vdpau_h264_picture_complete(MpegEncContext *s)
{
H264Context *h = s->avctx->priv_data;
struct vdpau_render_state *render;
render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
assert(render);
render->info.h264.slice_count = h->slice_num;
if (render->info.h264.slice_count < 1)
return;
render->info.h264.is_reference = (s->current_picture_ptr->reference & 3) ? VDP_TRUE : VDP_FALSE;
render->info.h264.field_pic_flag = s->picture_structure != PICT_FRAME; render->info.h264.field_pic_flag = s->picture_structure != PICT_FRAME;
render->info.h264.bottom_field_flag = s->picture_structure == PICT_BOTTOM_FIELD; render->info.h264.bottom_field_flag = s->picture_structure == PICT_BOTTOM_FIELD;
render->info.h264.num_ref_frames = h->sps.ref_frame_count; render->info.h264.num_ref_frames = h->sps.ref_frame_count;
......
...@@ -33,6 +33,7 @@ void ff_vdpau_add_data_chunk(MpegEncContext *s, const uint8_t *buf, ...@@ -33,6 +33,7 @@ void ff_vdpau_add_data_chunk(MpegEncContext *s, const uint8_t *buf,
void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf, void ff_vdpau_mpeg_picture_complete(MpegEncContext *s, const uint8_t *buf,
int buf_size, int slice_count); int buf_size, int slice_count);
void ff_vdpau_h264_picture_start(MpegEncContext *s);
void ff_vdpau_h264_set_reference_frames(MpegEncContext *s); void ff_vdpau_h264_set_reference_frames(MpegEncContext *s);
void ff_vdpau_h264_picture_complete(MpegEncContext *s); void ff_vdpau_h264_picture_complete(MpegEncContext *s);
......
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