changeset 9934:89da8ec89558

vf_clone_mpi_attributes()
author michael
date Sat, 19 Apr 2003 02:48:53 +0000
parents 3548701a13fe
children cb685216dc73
files libmpcodecs/vf.c libmpcodecs/vf.h libmpcodecs/vf_noise.c libmpcodecs/vf_scale.c libmpcodecs/vf_swapuv.c libmpcodecs/vf_unsharp.c libmpcodecs/vf_yuy2.c libmpcodecs/vf_yvu9.c
diffstat 8 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vf.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf.c	Sat Apr 19 02:48:53 2003 +0000
@@ -422,6 +422,15 @@
     return best;
 }
 
+void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){
+    dst->pict_type= src->pict_type;
+    dst->qscale_type= src->qscale_type;
+    if(dst->width == src->width && dst->height == src->height){
+	dst->qstride= src->qstride;
+	dst->qscale= src->qscale;
+    }
+}
+
 int vf_next_config(struct vf_instance_s* vf,
         int width, int height, int d_width, int d_height,
 	unsigned int voflags, unsigned int outfmt){
--- a/libmpcodecs/vf.h	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf.h	Sat Apr 19 02:48:53 2003 +0000
@@ -74,6 +74,7 @@
 vf_instance_t* vf_open_encoder(vf_instance_t* next, char *name, char *args);
 
 unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int preferred);
+void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src);
 
 // default wrappers:
 int vf_next_config(struct vf_instance_s* vf,
--- a/libmpcodecs/vf_noise.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_noise.c	Sat Apr 19 02:48:53 2003 +0000
@@ -351,8 +351,7 @@
 	noise(dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam);
 	noise(dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam);
 
-	dmpi->qscale=mpi->qscale;
-	dmpi->qstride=mpi->qstride;
+        vf_clone_mpi_attributes(dmpi, mpi);
 
 #ifdef HAVE_MMX
 	if(gCpuCaps.hasMMX) asm volatile ("emms\n\t");
--- a/libmpcodecs/vf_scale.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_scale.c	Sat Apr 19 02:48:53 2003 +0000
@@ -251,8 +251,7 @@
     if(vf->priv->w==mpi->w && vf->priv->h==mpi->h){
 	// just conversion, no scaling -> keep postprocessing data
 	// this way we can apply pp filter to non-yv12 source using scaler
-	dmpi->qscale=mpi->qscale;
-	dmpi->qstride=mpi->qstride;
+        vf_clone_mpi_attributes(dmpi, mpi);
     }
 
     if(vf->priv->palette) dmpi->planes[1]=vf->priv->palette; // export palette!
--- a/libmpcodecs/vf_swapuv.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_swapuv.c	Sat Apr 19 02:48:53 2003 +0000
@@ -70,9 +70,7 @@
 	dmpi->width=mpi->width;
     }
     
-    dmpi->qscale=mpi->qscale;
-    dmpi->qstride=mpi->qstride;
-    dmpi->pict_type=mpi->pict_type;
+    vf_clone_mpi_attributes(dmpi, mpi);
 
     return vf_next_put_image(vf,dmpi);
 }
--- a/libmpcodecs/vf_unsharp.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_unsharp.c	Sat Apr 19 02:48:53 2003 +0000
@@ -200,8 +200,7 @@
     unsharp( dmpi->planes[1], mpi->planes[1], dmpi->stride[1], mpi->stride[1], mpi->w/2, mpi->h/2, &vf->priv->chromaParam );
     unsharp( dmpi->planes[2], mpi->planes[2], dmpi->stride[2], mpi->stride[2], mpi->w/2, mpi->h/2, &vf->priv->chromaParam );
     
-    dmpi->qscale = mpi->qscale;
-    dmpi->qstride = mpi->qstride;
+    vf_clone_mpi_attributes(dmpi, mpi);
     
 #ifdef HAVE_MMX
     if(gCpuCaps.hasMMX)
--- a/libmpcodecs/vf_yuy2.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_yuy2.c	Sat Apr 19 02:48:53 2003 +0000
@@ -42,8 +42,7 @@
     yv12toyuy2(mpi->planes[0],mpi->planes[1],mpi->planes[2], dmpi->planes[0],
 	    mpi->w,mpi->h, mpi->stride[0],mpi->stride[1],dmpi->stride[0]);
     
-    dmpi->qscale=mpi->qscale;
-    dmpi->qstride=mpi->qstride;
+    vf_clone_mpi_attributes(dmpi, mpi);
     
     return vf_next_put_image(vf,dmpi);
 }
--- a/libmpcodecs/vf_yvu9.c	Sat Apr 19 01:39:37 2003 +0000
+++ b/libmpcodecs/vf_yvu9.c	Sat Apr 19 02:48:53 2003 +0000
@@ -55,8 +55,7 @@
 	for(x=0;x<w;x++) d[2*x]=d[2*x+1]=s[x];
     }
 
-    dmpi->qscale=mpi->qscale;
-    dmpi->qstride=mpi->qstride;
+    vf_clone_mpi_attributes(dmpi, mpi);
     
     return vf_next_put_image(vf,dmpi);
 }