Author: reimar Date: Mon May 14 20:11:24 2012 New Revision: 34897 Log: Allow direct rendering for non-reference frames in H.264. This might work for other codecs that currently have DR disabled, but H.264 is the only one tested so far. Modified: trunk/libmpcodecs/vd_ffmpeg.c Modified: trunk/libmpcodecs/vd_ffmpeg.c ============================================================================== --- trunk/libmpcodecs/vd_ffmpeg.c Sun May 13 21:55:27 2012 (r34896) +++ trunk/libmpcodecs/vd_ffmpeg.c Mon May 14 20:11:24 2012 (r34897) @@ -61,6 +61,7 @@ typedef struct { enum PixelFormat pix_fmt; int do_slices; int do_dr1; + int nonref_dr; ///< allow dr only for non-reference frames int vo_initialized; int best_csp; int qp_stat[32]; @@ -243,8 +244,9 @@ static int init(sh_video_t *sh){ if(use_slices && (lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) && !do_vis_debug) ctx->do_slices=1; - if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_H264 && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) + if(lavc_codec->capabilities&CODEC_CAP_DR1 && !do_vis_debug && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO && lavc_codec->id != CODEC_ID_VP8 && lavc_codec->id != CODEC_ID_LAGARITH) ctx->do_dr1=1; + ctx->nonref_dr = lavc_codec->id == CODEC_ID_H264; ctx->ip_count= ctx->b_count= 0; ctx->pic = avcodec_alloc_frame(); @@ -560,6 +562,12 @@ static int get_buffer(AVCodecContext *av } } + if (ctx->nonref_dr) { + if (flags & MP_IMGFLAG_PRESERVE) + return avcodec_default_get_buffer(avctx, pic); + type = MP_IMGTYPE_TEMP; + } + if(init_vo(sh, avctx->pix_fmt) < 0){ avctx->release_buffer= avcodec_default_release_buffer; avctx->get_buffer= avcodec_default_get_buffer; @@ -677,6 +685,8 @@ static void release_buffer(struct AVCode sh_video_t *sh = avctx->opaque; vd_ffmpeg_ctx *ctx = sh->context; int i; + if (pic->type != FF_BUFFER_TYPE_USER) + return avcodec_default_release_buffer(avctx, pic); //printf("release buffer %d %d %d\n", mpi ? mpi->flags&MP_IMGFLAG_PRESERVE : -99, ctx->ip_count, ctx->b_count);
Author: reimar Date: Mon May 14 20:11:24 2012 New Revision: 34897
Log: Allow direct rendering for non-reference frames in H.264. This might work for other codecs that currently have DR disabled, but H.264 is the only one tested so far.
This causes problems, please see the topic "Problem with avc1 mp4" on the users list. Ingo
On 5/15/12, Ingo Brückl <ib@wupperonline.de> wrote:
Author: reimar Date: Mon May 14 20:11:24 2012 New Revision: 34897
Log: Allow direct rendering for non-reference frames in H.264. This might work for other codecs that currently have DR disabled, but H.264 is the only one tested so far.
This causes problems, please see the topic "Problem with avc1 mp4" on the users list.
I user from the irc channel claims this commit broke VDPAU decoding. He tried the most recent version (r34911) and it still seems broken. Please take a look.
On Fri, May 18, 2012 at 12:24:49AM +0300, Ivan Kalvachev wrote:
On 5/15/12, Ingo Brückl <ib@wupperonline.de> wrote:
Author: reimar Date: Mon May 14 20:11:24 2012 New Revision: 34897
Log: Allow direct rendering for non-reference frames in H.264. This might work for other codecs that currently have DR disabled, but H.264 is the only one tested so far.
This causes problems, please see the topic "Problem with avc1 mp4" on the users list.
I user from the irc channel claims this commit broke VDPAU decoding. He tried the most recent version (r34911) and it still seems broken. Please take a look.
I believe I fixed it, can someone try?
On 5/18/12, Reimar Döffinger <Reimar.Doeffinger@gmx.de> wrote:
On Fri, May 18, 2012 at 12:24:49AM +0300, Ivan Kalvachev wrote:
On 5/15/12, Ingo Brückl <ib@wupperonline.de> wrote:
Author: reimar Date: Mon May 14 20:11:24 2012 New Revision: 34897
Log: Allow direct rendering for non-reference frames in H.264. This might work for other codecs that currently have DR disabled, but H.264 is the only one tested so far.
This causes problems, please see the topic "Problem with avc1 mp4" on the users list.
I user from the irc channel claims this commit broke VDPAU decoding. He tried the most recent version (r34911) and it still seems broken. Please take a look.
I believe I fixed it, can someone try?
The user confirmed the fix.
participants (4)
-
Ingo Brückl -
Ivan Kalvachev -
reimar -
Reimar Döffinger