# HG changeset patch # User rfelker # Date 1061218146 0 # Node ID 711159267b2d579c1f1f31cd41d913f14d8ffaa7 # Parent 5cf84c487446610edd4a474ac52d5f4d48fe8cde 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 :) diff -r 5cf84c487446 -r 711159267b2d libmpcodecs/mp_image.h --- a/libmpcodecs/mp_image.h Mon Aug 18 14:24:29 2003 +0000 +++ b/libmpcodecs/mp_image.h Mon Aug 18 14:49:06 2003 +0000 @@ -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) */ diff -r 5cf84c487446 -r 711159267b2d libmpcodecs/vd_libmpeg2.c --- a/libmpcodecs/vd_libmpeg2.c Mon Aug 18 14:24:29 2003 +0000 +++ b/libmpcodecs/vd_libmpeg2.c Mon Aug 18 14:49:06 2003 +0000 @@ -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){ diff -r 5cf84c487446 -r 711159267b2d libmpcodecs/vf.c --- a/libmpcodecs/vf.c Mon Aug 18 14:24:29 2003 +0000 +++ b/libmpcodecs/vf.c Mon Aug 18 14:49:06 2003 +0000 @@ -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; diff -r 5cf84c487446 -r 711159267b2d libmpcodecs/vf_softpulldown.c --- a/libmpcodecs/vf_softpulldown.c Mon Aug 18 14:24:29 2003 +0000 +++ b/libmpcodecs/vf_softpulldown.c Mon Aug 18 14:49:06 2003 +0000 @@ -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;