[FFmpeg-devel] [PATCH]Allow MPEG4 VDPAU decoding
Michael Niedermayer
michaelni
Fri Nov 6 14:40:04 CET 2009
On Thu, Nov 05, 2009 at 02:19:30AM +0100, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached is a new (tested) version of the patch to support MPEG4 VDPAU
> decoding.
>
> Please comment, Carl Eugen
[...]
> +void ff_vdpau_mpeg4_decode_picture(MpegEncContext *s, const uint8_t *buf,
> + int buf_size)
> +{
> + struct vdpau_render_state *render, *last, *next;
> + int i;
> +
> + if (!s->current_picture_ptr) return;
> +
> + render = (struct vdpau_render_state *)s->current_picture_ptr->data[0];
> + assert(render);
> +
> + /* fill VdpPictureInfoMPEG4Part2 struct */
> + render->info.mpeg4.vop_time_increment_resolution = s->avctx->time_base.den;
> + render->info.mpeg4.vop_coding_type = 0;
> + render->info.mpeg4.vop_fcode_forward = s->f_code;
> + render->info.mpeg4.vop_fcode_backward = s->b_code;
> + render->info.mpeg4.resync_marker_disable = !s->resync_marker;
> + render->info.mpeg4.interlaced = !s->progressive_sequence;
> + render->info.mpeg4.quant_type = s->mpeg_quant;
> + render->info.mpeg4.quarter_sample = s->quarter_sample;
> + render->info.mpeg4.short_video_header = s->avctx->codec->id == CODEC_ID_H263;
> + render->info.mpeg4.rounding_control = s->no_rounding;
> + render->info.mpeg4.alternate_vertical_scan_flag = s->alternate_scan;
> + render->info.mpeg4.top_field_first = s->top_field_first;
> + for (i = 0; i < 64; ++i) {
> + render->info.mpeg4.intra_quantizer_matrix[i] = s->intra_matrix[i];
> + render->info.mpeg4.non_intra_quantizer_matrix[i] = s->inter_matrix[i];
> + }
> + render->info.mpeg4.forward_reference = VDP_INVALID_HANDLE;
> + render->info.mpeg4.backward_reference = VDP_INVALID_HANDLE;
> +
> + switch (s->pict_type) {
> + case FF_B_TYPE:
> + next = (struct vdpau_render_state *)s->next_picture.data[0];
> + assert(next);
> + render->info.mpeg4.backward_reference = next->surface;
> + render->info.mpeg4.vop_coding_type = 2;
> + // no break here, going to set forward prediction
> + case FF_P_TYPE:
> + last = (struct vdpau_render_state *)s->last_picture.data[0];
> + if (!last) // FIXME: Does this test make sense?
> + last = render; // predict second field from the first
i dont think this test makes sense, there is no I field + P field in
mpeg4-asp actually there are no field pictures in there at all ...
> + render->info.mpeg4.forward_reference = last->surface;
> + if (!render->info.mpeg4.vop_coding_type)
> + render->info.mpeg4.vop_coding_type = 1;
this looks unneeded as well
[...]
> @@ -67,6 +67,8 @@
> s->h263_pred = 1;
> s->low_delay = 0; //default, might be overriden in the vol header during header parsing
> avctx->chroma_sample_location = AVCHROMA_LOC_LEFT;
> + if (CONFIG_MPEG4_VDPAU_DECODER && (s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU))
> + avctx->codec->pix_fmts = (enum PixelFormat[]){PIX_FMT_VDPAU_MPEG4, PIX_FMT_NONE};
> break;
> case CODEC_ID_MSMPEG4V1:
> s->h263_msmpeg4 = 1;
you cant do that, avctx->codec is shared amongth all instances of mpeg4
decoders
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091106/1f6f0ad4/attachment.pgp>
More information about the ffmpeg-devel
mailing list