On Thu,  8 May 2014 15:15:10 +0200, Luca Barbato <[email protected]> wrote:
> From: Anton Khirnov <[email protected]>
> 
> It leverages the new hwaccel 1.2 features:
> 
> - get_buffer2 is never called
> - the internal context is automatically initialized/deinitialized
> 
> Signed-off-by: Luca Barbato <[email protected]>
> ---
>  libavcodec/Makefile       |   1 +
>  libavcodec/allcodecs.c    |   1 +
>  libavcodec/h264_slice.c   |   6 +-
>  libavcodec/vda.c          |  72 +++++++++++++
>  libavcodec/vda.h          |  53 ++++++++++
>  libavcodec/vda_h264.c     | 257 
> ++++++++++++++++++++++++++++++++++++++++++++--
>  libavcodec/vda_internal.h |  33 ++++++
>  7 files changed, 414 insertions(+), 9 deletions(-)
>  create mode 100644 libavcodec/vda.c
>  create mode 100644 libavcodec/vda_internal.h
> 
> diff --git a/libavcodec/Makefile b/libavcodec/Makefile
> index 2bce954..e8f1253 100644
> --- a/libavcodec/Makefile
> +++ b/libavcodec/Makefile
> @@ -68,6 +68,7 @@ OBJS-$(CONFIG_RDFT)                    += rdft.o 
> $(RDFT-OBJS-yes)
>  OBJS-$(CONFIG_SINEWIN)                 += sinewin.o
>  OBJS-$(CONFIG_TPELDSP)                 += tpeldsp.o
>  OBJS-$(CONFIG_VAAPI)                   += vaapi.o
> +OBJS-$(CONFIG_VDA)                     += vda.o
>  OBJS-$(CONFIG_VDPAU)                   += vdpau.o
>  OBJS-$(CONFIG_VIDEODSP)                += videodsp.o
>  OBJS-$(CONFIG_VP3DSP)                  += vp3dsp.o
> diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
> index dcd6c4e..9f4fd25 100644
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -79,6 +79,7 @@ void avcodec_register_all(void)
>      REGISTER_HWACCEL(H264_DXVA2,        h264_dxva2);
>      REGISTER_HWACCEL(H264_VAAPI,        h264_vaapi);
>      REGISTER_HWACCEL(H264_VDA,          h264_vda);
> +    REGISTER_HWACCEL(H264_VDA_OLD,      h264_vda_old);
>      REGISTER_HWACCEL(H264_VDPAU,        h264_vdpau);
>      REGISTER_HWACCEL(MPEG1_VDPAU,       mpeg1_vdpau);
>      REGISTER_HWACCEL(MPEG2_DXVA2,       mpeg2_dxva2);
> diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
> index e727233..ea7fd6f 100644
> --- a/libavcodec/h264_slice.c
> +++ b/libavcodec/h264_slice.c
> @@ -153,6 +153,7 @@ static const enum AVPixelFormat 
> h264_hwaccel_pixfmt_list_420[] = {
>  #endif
>  #if CONFIG_H264_VDA_HWACCEL
>      AV_PIX_FMT_VDA_VLD,
> +    AV_PIX_FMT_VDA,
>  #endif
>  #if CONFIG_H264_VDPAU_HWACCEL
>      AV_PIX_FMT_VDPAU,
> @@ -170,6 +171,7 @@ static const enum AVPixelFormat 
> h264_hwaccel_pixfmt_list_jpeg_420[] = {
>  #endif
>  #if CONFIG_H264_VDA_HWACCEL
>      AV_PIX_FMT_VDA_VLD,
> +    AV_PIX_FMT_VDA,
>  #endif
>  #if CONFIG_H264_VDPAU_HWACCEL
>      AV_PIX_FMT_VDPAU,
> @@ -242,6 +244,7 @@ static int init_table_pools(H264Context *h)
>  
>  static int alloc_picture(H264Context *h, H264Picture *pic)
>  {
> +    const AVHWAccel *hwaccel = h->avctx->hwaccel;
>      int i, ret = 0;
>  
>      av_assert0(!pic->f.data[0]);
> @@ -255,8 +258,7 @@ static int alloc_picture(H264Context *h, H264Picture *pic)
>      h->linesize   = pic->f.linesize[0];
>      h->uvlinesize = pic->f.linesize[1];
>  
> -    if (h->avctx->hwaccel) {
> -        const AVHWAccel *hwaccel = h->avctx->hwaccel;
> +    if (hwaccel) {
>          av_assert0(!pic->hwaccel_picture_private);
>          if (hwaccel->frame_priv_data_size) {
>              pic->hwaccel_priv_buf = 
> av_buffer_allocz(hwaccel->frame_priv_data_size);

This hunk now looks unnecessary

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to