vaapi: remove unused hw image formats, simplify

PIX_FMT_VDA_VLD and PIX_FMT_VAAPI_VLD were never used anywhere. I'm not
sure why they were even added, and they sound like they are just for
compatibility with XvMC-style decoding, which sucks anyway.

Now that there's only a single vaapi format, remove the
IMGFMT_IS_VAAPI() macro. Also get rid of IMGFMT_IS_VDA(), which was
unused.
This commit is contained in:
wm4 2013-11-29 14:19:29 +01:00
parent 0d255f07bf
commit 60cd300558
7 changed files with 11 additions and 26 deletions

View File

@ -212,7 +212,7 @@ static int create_decoder(struct lavc_ctx *ctx)
VAStatus status;
int res = -1;
assert(IMGFMT_IS_VAAPI(p->format));
assert(p->format == IMGFMT_VAAPI);
destroy_decoder(ctx);
@ -307,7 +307,7 @@ static struct mp_image *allocate_image(struct lavc_ctx *ctx, int format,
{
struct priv *p = ctx->hwdec_priv;
if (!IMGFMT_IS_VAAPI(format))
if (format != IMGFMT_VAAPI)
return NULL;
if (format != p->format || w != p->w || h != p->h ||

View File

@ -268,7 +268,7 @@ static void uninit(struct vf_instance *vf)
static int query_format(struct vf_instance *vf, unsigned int imgfmt)
{
struct vf_priv_s *p = vf->priv;
if (IMGFMT_IS_VAAPI(imgfmt) || va_image_format_from_imgfmt(p->va->image_formats, imgfmt))
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->va->image_formats, imgfmt))
return vf_next_query_format(vf, IMGFMT_VAAPI);
return 0;
}

View File

@ -190,11 +190,8 @@ static const struct {
{IMGFMT_VDPAU, PIX_FMT_VDPAU_H264},
#endif
{ IMGFMT_VDA, PIX_FMT_VDA_VLD},
{IMGFMT_VAAPI, PIX_FMT_VAAPI_VLD},
{IMGFMT_VAAPI_MPEG2_IDCT, PIX_FMT_VAAPI_IDCT},
{IMGFMT_VAAPI_MPEG2_MOCO, PIX_FMT_VAAPI_MOCO},
{IMGFMT_VDA, PIX_FMT_VDA_VLD},
{IMGFMT_VAAPI, PIX_FMT_VAAPI_VLD},
{0, PIX_FMT_NONE}
};

View File

@ -121,8 +121,6 @@ struct mp_imgfmt_entry mp_imgfmt_list[] = {
FMT("vdpau", IMGFMT_VDPAU)
FMT("vda", IMGFMT_VDA)
FMT("vaapi", IMGFMT_VAAPI)
FMT("vaapi_mpeg2_idct", IMGFMT_VAAPI_MPEG2_IDCT)
FMT("vaapi_mpeg2_moco", IMGFMT_VAAPI_MPEG2_MOCO)
{0}
};

View File

@ -260,11 +260,6 @@ enum mp_imgfmt {
IMGFMT_VDA,
IMGFMT_VAAPI,
IMGFMT_VAAPI_MPEG2_IDCT,
IMGFMT_VAAPI_MPEG2_MOCO,
IMGFMT_VAAPI_FIRST = IMGFMT_VAAPI,
IMGFMT_VAAPI_LAST = IMGFMT_VAAPI_MPEG2_MOCO,
IMGFMT_END,
@ -342,13 +337,8 @@ static inline bool IMGFMT_IS_RGB(unsigned int fmt)
#define IMGFMT_IS_VDPAU(fmt) \
(((fmt) >= IMGFMT_VDPAU_FIRST) && ((fmt) <= IMGFMT_VDPAU_LAST))
#define IMGFMT_IS_VDA(fmt) (((fmt) == IMGFMT_VDA))
#define IMGFMT_IS_VAAPI(fmt) \
(((fmt) >= IMGFMT_VAAPI_FIRST) && ((fmt) <= IMGFMT_VAAPI_LAST))
#define IMGFMT_IS_HWACCEL(fmt) \
(IMGFMT_IS_VDPAU(fmt) || IMGFMT_IS_VAAPI(fmt) || IMGFMT_IS_VDA(fmt))
(IMGFMT_IS_VDPAU(fmt) || ((fmt) == IMGFMT_VAAPI) || ((fmt) == IMGFMT_VDA))
struct mp_imgfmt_entry {

View File

@ -160,7 +160,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
vo_x11_config_vo_window(vo, NULL, vo->dx, vo->dy, vo->dwidth, vo->dheight,
flags, "vaapi");
if (!IMGFMT_IS_VAAPI(params->imgfmt)) {
if (params->imgfmt != IMGFMT_VAAPI) {
if (!alloc_swdec_surfaces(p, params->w, params->h, params->imgfmt))
return -1;
}
@ -173,7 +173,7 @@ static int reconfig(struct vo *vo, struct mp_image_params *params, int flags)
static int query_format(struct vo *vo, uint32_t imgfmt)
{
struct priv *p = vo->priv;
if (IMGFMT_IS_VAAPI(imgfmt) || va_image_format_from_imgfmt(p->va_image_formats, imgfmt))
if (imgfmt == IMGFMT_VAAPI || va_image_format_from_imgfmt(p->va_image_formats, imgfmt))
return VFCAP_CSP_SUPPORTED | VFCAP_CSP_SUPPORTED_BY_HW;
return 0;
@ -272,7 +272,7 @@ static void draw_image(struct vo *vo, struct mp_image *mpi)
{
struct priv *p = vo->priv;
if (!IMGFMT_IS_VAAPI(mpi->imgfmt)) {
if (mpi->imgfmt != IMGFMT_VAAPI) {
struct mp_image *wrapper = p->swdec_surfaces[p->output_surface];
struct va_surface *surface = va_surface_in_mp_image(wrapper);
if (!surface || !va_surface_upload(surface, mpi)) {

View File

@ -405,13 +405,13 @@ struct mp_image *va_surface_wrap(struct va_surface *surface)
VASurfaceID va_surface_id_in_mp_image(const struct mp_image *mpi)
{
return mpi && IMGFMT_IS_VAAPI(mpi->imgfmt) ?
return mpi && mpi->imgfmt == IMGFMT_VAAPI ?
(VASurfaceID)(uintptr_t)mpi->planes[3] : VA_INVALID_ID;
}
struct va_surface *va_surface_in_mp_image(struct mp_image *mpi)
{
return mpi && IMGFMT_IS_VAAPI(mpi->imgfmt) ?
return mpi && mpi->imgfmt == IMGFMT_VAAPI ?
(struct va_surface*)mpi->planes[0] : NULL;
}