Commit cba442e2 authored by Laurent Aimar's avatar Laurent Aimar

Simplify a bit vout_ChromaCmp.

parent d1155aae
...@@ -955,72 +955,42 @@ int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic, ...@@ -955,72 +955,42 @@ int __vout_InitPicture( vlc_object_t *p_this, picture_t *p_pic,
*/ */
int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc ) int vout_ChromaCmp( vlc_fourcc_t i_chroma, vlc_fourcc_t i_amorhc )
{ {
static const vlc_fourcc_t p_I420[] = {
FOURCC_I420, FOURCC_IYUV, FOURCC_YV12, 0
};
static const vlc_fourcc_t p_UYVY[] = {
FOURCC_UYVY, FOURCC_UYNV, FOURCC_Y422, 0
};
static const vlc_fourcc_t p_YUYV[] = {
FOURCC_YUY2, FOURCC_YUNV, 0
};
static const vlc_fourcc_t p_GREY[] = {
FOURCC_GREY, FOURCC_Y800, FOURCC_Y8, 0
};
static const vlc_fourcc_t *pp_fcc[] = {
p_I420, p_UYVY, p_YUYV, p_GREY, NULL
};
/* If they are the same, they are the same ! */ /* If they are the same, they are the same ! */
if( i_chroma == i_amorhc ) if( i_chroma == i_amorhc )
{
return 1; return 1;
}
/* Check for equivalence classes */ /* Check for equivalence classes */
switch( i_chroma ) for( int i = 0; pp_fcc[i] != NULL; i++ )
{ {
case FOURCC_I420: bool b_fcc1 = false;
case FOURCC_IYUV: bool b_fcc2 = false;
case FOURCC_YV12: for( int j = 0; pp_fcc[i][j] != 0; j++ )
switch( i_amorhc ) {
{ if( i_chroma == pp_fcc[i][j] )
case FOURCC_I420: b_fcc1 = true;
case FOURCC_IYUV: if( i_amorhc == pp_fcc[i][j] )
case FOURCC_YV12: b_fcc2 = true;
return 1; }
if( b_fcc1 && b_fcc2 )
default: return 1;
return 0;
}
case FOURCC_UYVY:
case FOURCC_UYNV:
case FOURCC_Y422:
switch( i_amorhc )
{
case FOURCC_UYVY:
case FOURCC_UYNV:
case FOURCC_Y422:
return 1;
default:
return 0;
}
case FOURCC_YUY2:
case FOURCC_YUNV:
switch( i_amorhc )
{
case FOURCC_YUY2:
case FOURCC_YUNV:
return 1;
default:
return 0;
}
case FOURCC_GREY:
case FOURCC_Y800:
case FOURCC_Y8:
switch( i_amorhc )
{
case FOURCC_GREY:
case FOURCC_Y800:
case FOURCC_Y8:
return 1;
default:
return 0;
}
default:
return 0;
} }
return 0;
} }
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment