1
mirror of https://github.com/mpv-player/mpv synced 2024-09-12 23:45:53 +02:00

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 :)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10664 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
rfelker 2003-08-18 14:49:06 +00:00
parent db1804fcac
commit 48ecb3e717
4 changed files with 22 additions and 16 deletions

View File

@ -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 @@ typedef struct mp_image_s {
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) */

View File

@ -144,11 +144,12 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
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){

View File

@ -439,7 +439,7 @@ unsigned int vf_match_csp(vf_instance_t** vfp,unsigned int* list,unsigned int pr
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;

View File

@ -37,7 +37,7 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
{
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 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
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 @@ static int put_image(struct vf_instance_s* vf, mp_image_t *mpi)
}
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;