[MPlayer-dev-eng] [PATCH] get rid of mc_render_slice

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Feb 14 22:24:19 CET 2009


Hello,
the two extra asserts and a few arithmetic operations less don't seem
worth the extra function to me, particularly since inspires others (e.g.
NVidia) to duplicate the code once more...
I am also quite irritated at why those functions are set once in init
and once in get_format (that code was never really reviewed, was it?).

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libmpcodecs/vd_ffmpeg.c
===================================================================
--- libmpcodecs/vd_ffmpeg.c	(revision 28567)
+++ libmpcodecs/vd_ffmpeg.c	(working copy)
@@ -55,15 +55,14 @@
 
 static int get_buffer(AVCodecContext *avctx, AVFrame *pic);
 static void release_buffer(AVCodecContext *avctx, AVFrame *pic);
+static void draw_slice(struct AVCodecContext *s, AVFrame *src, int offset[4],
+                       int y, int type, int height);
 
 #if CONFIG_XVMC
 static enum PixelFormat get_format(struct AVCodecContext *avctx,
                                    const enum PixelFormat *pix_fmt);
 static int mc_get_buffer(AVCodecContext *avctx, AVFrame *pic);
 static void mc_release_buffer(AVCodecContext *avctx, AVFrame *pic);
-static void mc_render_slice(struct AVCodecContext *s,
-                        AVFrame *src, int offset[4],
-                        int y, int type, int height);
 #endif
 
 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT;
@@ -254,7 +253,7 @@
         avctx->get_format= get_format;//for now only this decoder will use it
         avctx->get_buffer= mc_get_buffer;
         avctx->release_buffer= mc_release_buffer;
-        avctx->draw_horiz_band = mc_render_slice;
+        avctx->draw_horiz_band = draw_slice;
         avctx->slice_flags=SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD;
     }else
 #endif /* CONFIG_XVMC */
@@ -857,7 +856,7 @@
         vd_ffmpeg_ctx *ctx = sh->context;
         avctx->get_buffer= mc_get_buffer;
         avctx->release_buffer= mc_release_buffer;
-        avctx->draw_horiz_band = mc_render_slice;
+        avctx->draw_horiz_band = draw_slice;
         mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2);
         assert(ctx->do_dr1);//these are must to!
         assert(ctx->do_slices); //it is (vo_)ffmpeg bug if this fails
@@ -887,7 +886,6 @@
         exit(1);
 //        return -1;//!!fixme check error conditions
     }
-    assert(avctx->draw_horiz_band == mc_render_slice);
     assert(avctx->release_buffer == mc_release_buffer);
     if(mp_msg_test(MSGT_DECVIDEO, MSGL_DBG5))
         mp_msg(MSGT_DECVIDEO, MSGL_DBG5, "vd_ffmpeg::mc_get_buffer\n");
@@ -993,18 +991,4 @@
     }
 }
 
-static void mc_render_slice(struct AVCodecContext *s,
-                        AVFrame *src, int offset[4],
-                        int y, int type, int height){
-    int width= s->width;
-    sh_video_t *sh = s->opaque;
-    uint8_t *source[3]= {src->data[0], src->data[1], src->data[2]};
-
-    assert(src->linesize[0]==0 && src->linesize[1]==0 && src->linesize[2]==0);
-    assert(offset[0]==0 && offset[1]==0 && offset[2]==0);
-
-    mpcodecs_draw_slice (sh, source, src->linesize, width, height, 0, y);
-
-}
-
 #endif /* CONFIG_XVMC */


More information about the MPlayer-dev-eng mailing list