From 60cd30055812d95aba453bdcb9b316e63fda5a31 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 29 Nov 2013 14:19:29 +0100 Subject: 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. --- video/decode/vaapi.c | 4 ++-- video/filter/vf_vavpp.c | 2 +- video/fmt-conversion.c | 7 ++----- video/img_format.c | 2 -- video/img_format.h | 12 +----------- video/out/vo_vaapi.c | 6 +++--- video/vaapi.c | 4 ++-- 7 files changed, 11 insertions(+), 26 deletions(-) diff --git a/video/decode/vaapi.c b/video/decode/vaapi.c index a27e3cde93..f1a270a7c7 100644 --- a/video/decode/vaapi.c +++ b/video/decode/vaapi.c @@ -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 || diff --git a/video/filter/vf_vavpp.c b/video/filter/vf_vavpp.c index fddc870550..c96d23590b 100644 --- a/video/filter/vf_vavpp.c +++ b/video/filter/vf_vavpp.c @@ -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; } diff --git a/video/fmt-conversion.c b/video/fmt-conversion.c index b908837547..371e81c399 100644 --- a/video/fmt-conversion.c +++ b/video/fmt-conversion.c @@ -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} }; diff --git a/video/img_format.c b/video/img_format.c index 5e3c382df4..73e50bd803 100644 --- a/video/img_format.c +++ b/video/img_format.c @@ -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} }; diff --git a/video/img_format.h b/video/img_format.h index 1cfe4465ec..5abeb9c46a 100644 --- a/video/img_format.h +++ b/video/img_format.h @@ -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 { diff --git a/video/out/vo_vaapi.c b/video/out/vo_vaapi.c index 9a9097acf1..c2d2bb9602 100644 --- a/video/out/vo_vaapi.c +++ b/video/out/vo_vaapi.c @@ -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)) { diff --git a/video/vaapi.c b/video/vaapi.c index fc6a7819e2..4607be9052 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -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; } -- cgit v1.2.3