[Mplayer-cvslog] CVS: main/libmpcodecs vf.c,1.87,1.88 vd_libmpeg2.c,1.25,1.26 mp_image.h,1.25,1.26 vf_softpulldown.c,1.1,1.2

Richard Felker CVS rfelker at mplayerhq.hu
Mon Aug 18 16:49:45 CEST 2003


Update of /cvsroot/mplayer/main/libmpcodecs
In directory mail:/var/tmp.root/cvs-serv1721

Modified Files:
	vf.c vd_libmpeg2.c mp_image.h vf_softpulldown.c 
Log Message:
clean up field flags:
1) cosmetic change, no reason these need to be mpeg2-specific
2) add a flag to tell when fields are ordered, so we don't have to
assume bff (which would usually be wrong) when field flags are not
available.
3) add other flags for future use :)


Index: vf.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf.c,v
retrieving revision 1.87
retrieving revision 1.88
diff -u -r1.87 -r1.88
--- vf.c	11 Aug 2003 20:04:30 -0000	1.87
+++ vf.c	18 Aug 2003 14:49:06 -0000	1.88
@@ -439,7 +439,7 @@
 
 void vf_clone_mpi_attributes(mp_image_t* dst, mp_image_t* src){
     dst->pict_type= src->pict_type;
-    dst->mpeg2_flags = src->mpeg2_flags;
+    dst->fields = src->fields;
     dst->qscale_type= src->qscale_type;
     if(dst->width == src->width && dst->height == src->height){
 	dst->qstride= src->qstride;

Index: vd_libmpeg2.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vd_libmpeg2.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- vd_libmpeg2.c	3 Aug 2003 12:09:58 -0000	1.25
+++ vd_libmpeg2.c	18 Aug 2003 14:49:06 -0000	1.26
@@ -144,11 +144,12 @@
 	    if(!mpi) return 0; // VO ERROR!!!!!!!!
 	    mpeg2_set_buf(mpeg2dec, mpi->planes, mpi);
 	    if (info->current_picture->flags&PIC_FLAG_TOP_FIELD_FIRST)
-		mpi->mpeg2_flags |= MP_IMGMPEG2FLAG_TOP_FIELD_FIRST;
-	    else mpi->mpeg2_flags &= ~MP_IMGMPEG2FLAG_TOP_FIELD_FIRST;
+		mpi->fields |= MP_IMGFIELD_TOP_FIRST;
+	    else mpi->fields &= ~MP_IMGFIELD_TOP_FIRST;
 	    if (info->current_picture->flags&PIC_FLAG_REPEAT_FIRST_FIELD)
-		mpi->mpeg2_flags |= MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD;
-	    else mpi->mpeg2_flags &= ~MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD;
+		mpi->fields |= MP_IMGFIELD_REPEAT_FIRST;
+	    else mpi->fields &= ~MP_IMGFIELD_REPEAT_FIRST;
+	    mpi->fields |= MP_IMGFIELD_ORDERED;
 
 #ifdef MPEG12_POSTPROC
 	    if(!mpi->qscale){

Index: mp_image.h
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/mp_image.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- mp_image.h	3 Aug 2003 12:09:58 -0000	1.25
+++ mp_image.h	18 Aug 2003 14:49:06 -0000	1.26
@@ -64,8 +64,11 @@
 
 #define MP_MAX_PLANES	4
 
-#define MP_IMGMPEG2FLAG_TOP_FIELD_FIRST 0x01
-#define MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD 0x02
+#define MP_IMGFIELD_ORDERED 0x01
+#define MP_IMGFIELD_TOP_FIRST 0x02
+#define MP_IMGFIELD_REPEAT_FIRST 0x04
+#define MP_IMGFIELD_TOP 0x08
+#define MP_IMGFIELD_BOTTOM 0x10
 
 typedef struct mp_image_s {
     unsigned short flags;
@@ -79,7 +82,7 @@
     char * qscale;
     int qstride;
     int pict_type; // 0->unknown, 1->I, 2->P, 3->B
-    int mpeg2_flags;
+    int fields;
     int qscale_type; // 0->mpeg1/4/h263, 1->mpeg2
     int num_planes;
     /* these are only used by planar formats Y,U(Cb),V(Cr) */

Index: vf_softpulldown.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpcodecs/vf_softpulldown.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vf_softpulldown.c	3 Aug 2003 12:09:58 -0000	1.1
+++ vf_softpulldown.c	18 Aug 2003 14:49:06 -0000	1.2
@@ -37,7 +37,7 @@
 {
 	mp_image_t *dmpi;
 	int ret = 0;
-	int flags = mpi->mpeg2_flags;
+	int flags = mpi->fields;
 	int state = vf->priv->state;
 
 	dmpi = vf_get_image(vf->next, mpi->imgfmt,
@@ -47,19 +47,21 @@
 	vf->priv->in++;
 
 	if ((state == 0 &&
-	     !(flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST)) ||
+	     !(flags & MP_IMGFIELD_TOP_FIRST)) ||
 	    (state == 1 &&
-	     flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST))
+	     flags & MP_IMGFIELD_TOP_FIRST)) {
 		mp_msg(MSGT_VFILTER, MSGL_WARN,
-		       "softpulldown: Unexpected mpeg2 flags: state=%d top_field_first=%d repeat_first_field=%d\n",
+		       "softpulldown: Unexpected field flags: state=%d top_field_first=%d repeat_first_field=%d\n",
 		       state,
-		       (flags & MP_IMGMPEG2FLAG_TOP_FIELD_FIRST) == 1,
-		       (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) == 1);
+		       (flags & MP_IMGFIELD_TOP_FIRST) != 0,
+		       (flags & MP_IMGFIELD_REPEAT_FIRST) != 0);
+		state ^= 1;
+	}
 
 	if (state == 0) {
 		ret = vf_next_put_image(vf, mpi);
 		vf->priv->out++;
-		if (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) {
+		if (flags & MP_IMGFIELD_REPEAT_FIRST) {
 			my_memcpy_pic(dmpi->planes[0],
 			           mpi->planes[0], mpi->w, mpi->h/2,
 			           dmpi->stride[0]*2, mpi->stride[0]*2);
@@ -95,7 +97,7 @@
 		}
 		ret = vf_next_put_image(vf, dmpi);
 		vf->priv->out++;
-		if (flags & MP_IMGMPEG2FLAG_REPEAT_FIRST_FIELD) {
+		if (flags & MP_IMGFIELD_REPEAT_FIRST) {
 			ret |= vf_next_put_image(vf, mpi);
 			vf->priv->out++;
 			state=0;



More information about the MPlayer-cvslog mailing list