[FFmpeg-devel] [PATCH] Port recent changes to MPlayer libmpcodecs.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Wed Jun 1 21:25:24 CEST 2011


Also include an older fix for vf_smartblur which was essentially
broken due to reading the threshold value wrongly.
---
 libavfilter/libmpcodecs/vf_divtc.c     |    3 ++-
 libavfilter/libmpcodecs/vf_ilpack.c    |   13 ++++++++-----
 libavfilter/libmpcodecs/vf_pp7.c       |    4 ++--
 libavfilter/libmpcodecs/vf_smartblur.c |    4 ++--
 libavfilter/libmpcodecs/vf_unsharp.c   |    2 +-
 5 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/libavfilter/libmpcodecs/vf_divtc.c b/libavfilter/libmpcodecs/vf_divtc.c
index 3ead472..4c171d1 100644
--- a/libavfilter/libmpcodecs/vf_divtc.c
+++ b/libavfilter/libmpcodecs/vf_divtc.c
@@ -598,7 +598,8 @@ static void uninit(struct vf_instance *vf)
 static int vf_open(vf_instance_t *vf, char *args)
    {
    struct vf_priv_s *p;
-   char *filename="framediff.log", *ap, *q, *a;
+   const char *filename="framediff.log";
+   char *ap, *q, *a;
 
    if(args && !(args=av_strdup(args)))
       {
diff --git a/libavfilter/libmpcodecs/vf_ilpack.c b/libavfilter/libmpcodecs/vf_ilpack.c
index 77555a7..db4a849 100644
--- a/libavfilter/libmpcodecs/vf_ilpack.c
+++ b/libavfilter/libmpcodecs/vf_ilpack.c
@@ -28,6 +28,7 @@
 #include "img_format.h"
 #include "mp_image.h"
 #include "vf.h"
+#include "libavutil/attributes.h"
 
 typedef void (pack_func_t)(unsigned char *dst, unsigned char *y,
     unsigned char *u, unsigned char *v, int w, int us, int vs);
@@ -38,7 +39,8 @@ struct vf_priv_s {
 };
 
 static void pack_nn_C(unsigned char *dst, unsigned char *y,
-    unsigned char *u, unsigned char *v, int w)
+    unsigned char *u, unsigned char *v, int w,
+    int av_unused us, int av_unused vs)
 {
     int j;
     for (j = w/2; j; j--) {
@@ -77,7 +79,8 @@ static void pack_li_1_C(unsigned char *dst, unsigned char *y,
 
 #if HAVE_MMX
 static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
-    unsigned char *u, unsigned char *v, int w)
+    unsigned char *u, unsigned char *v, int w,
+    int av_unused us, int av_unused vs)
 {
     __asm__ volatile (""
         ASMALIGN(4)
@@ -103,7 +106,7 @@ static void pack_nn_MMX(unsigned char *dst, unsigned char *y,
         : "r" (y), "r" (u), "r" (v), "r" (dst), "r" (w/8)
         : "memory"
         );
-    pack_nn_C(dst, y, u, v, (w&7));
+    pack_nn_C(dst, y, u, v, (w&7), 0, 0);
 }
 
 #if HAVE_EBX_AVAILABLE
@@ -413,12 +416,12 @@ static int vf_open(vf_instance_t *vf, char *args)
     vf->priv->mode = 1;
     if (args) sscanf(args, "%d", &vf->priv->mode);
 
-    pack_nn = (pack_func_t *)pack_nn_C;
+    pack_nn = pack_nn_C;
     pack_li_0 = pack_li_0_C;
     pack_li_1 = pack_li_1_C;
 #if HAVE_MMX
     if(gCpuCaps.hasMMX) {
-        pack_nn = (pack_func_t *)pack_nn_MMX;
+        pack_nn = pack_nn_MMX;
 #if HAVE_EBX_AVAILABLE
         pack_li_0 = pack_li_0_MMX;
         pack_li_1 = pack_li_1_MMX;
diff --git a/libavfilter/libmpcodecs/vf_pp7.c b/libavfilter/libmpcodecs/vf_pp7.c
index f8b64b6..c075d66 100644
--- a/libavfilter/libmpcodecs/vf_pp7.c
+++ b/libavfilter/libmpcodecs/vf_pp7.c
@@ -286,8 +286,8 @@ static void filter(struct vf_priv_s *p, uint8_t *dst, uint8_t *src, int dst_stri
     int x, y;
     const int stride= is_luma ? p->temp_stride : ((width+16+15)&(~15));
     uint8_t  *p_src= p->src + 8*stride;
-    DCTELEM *block= p->src;
-    DCTELEM *temp= p->src + 32;
+    DCTELEM *block= (DCTELEM *)p->src;
+    DCTELEM *temp= (DCTELEM *)(p->src + 32);
 
     if (!src || !dst) return; // HACK avoid crash for Y8 colourspace
     for(y=0; y<height; y++){
diff --git a/libavfilter/libmpcodecs/vf_smartblur.c b/libavfilter/libmpcodecs/vf_smartblur.c
index 3e20880..8acdb73 100644
--- a/libavfilter/libmpcodecs/vf_smartblur.c
+++ b/libavfilter/libmpcodecs/vf_smartblur.c
@@ -183,11 +183,11 @@ static inline void blur(uint8_t *dst, uint8_t *src, int w, int h, int dstStride,
 static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){
     int cw= mpi->w >> mpi->chroma_x_shift;
     int ch= mpi->h >> mpi->chroma_y_shift;
-    FilterParam *f= &vf->priv;
+    int threshold = vf->priv->luma.threshold || vf->priv->chroma.threshold;
 
     mp_image_t *dmpi=vf_get_image(vf->next,mpi->imgfmt,
         MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE|
-        (f->threshold) ? MP_IMGFLAG_READABLE : 0,
+        (threshold ? MP_IMGFLAG_READABLE : 0),
         mpi->w,mpi->h);
 
     assert(mpi->flags&MP_IMGFLAG_PLANAR);
diff --git a/libavfilter/libmpcodecs/vf_unsharp.c b/libavfilter/libmpcodecs/vf_unsharp.c
index cd46432..db22f78 100644
--- a/libavfilter/libmpcodecs/vf_unsharp.c
+++ b/libavfilter/libmpcodecs/vf_unsharp.c
@@ -132,7 +132,7 @@ static int config( struct vf_instance *vf,
 
     int z, stepsX, stepsY;
     FilterParam *fp;
-    char *effect;
+    const char *effect;
 
     // allocate buffers
 
-- 
1.7.4.1



More information about the ffmpeg-devel mailing list