[MPlayer-cvslog] r34897 - trunk/libmpcodecs/vd_ffmpeg.c

reimar subversion at mplayerhq.hu
Mon May 14 20:11:25 CEST 2012


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);
 


More information about the MPlayer-cvslog mailing list