Commit 5449239a authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '67afcefb'

* commit '67afcefb':
  lavc: Add new VDA hwaccel

Conflicts:
	configure
	libavcodec/vda.h
	libavcodec/vda_h264.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c6a683bf 67afcefb
...@@ -2196,6 +2196,8 @@ h264_vda_decoder_deps="vda" ...@@ -2196,6 +2196,8 @@ h264_vda_decoder_deps="vda"
h264_vda_decoder_select="h264_decoder" h264_vda_decoder_select="h264_decoder"
h264_vda_hwaccel_deps="vda" h264_vda_hwaccel_deps="vda"
h264_vda_hwaccel_select="h264_decoder" h264_vda_hwaccel_select="h264_decoder"
h264_vda_old_hwaccel_deps="vda"
h264_vda_old_hwaccel_select="h264_decoder"
h264_vdpau_decoder_deps="vdpau" h264_vdpau_decoder_deps="vdpau"
h264_vdpau_decoder_select="h264_decoder" h264_vdpau_decoder_select="h264_decoder"
h264_vdpau_hwaccel_deps="vdpau" h264_vdpau_hwaccel_deps="vdpau"
......
...@@ -78,6 +78,7 @@ OBJS-$(CONFIG_SHARED) += log2_tab.o ...@@ -78,6 +78,7 @@ OBJS-$(CONFIG_SHARED) += log2_tab.o
OBJS-$(CONFIG_SINEWIN) += sinewin.o OBJS-$(CONFIG_SINEWIN) += sinewin.o
OBJS-$(CONFIG_TPELDSP) += tpeldsp.o OBJS-$(CONFIG_TPELDSP) += tpeldsp.o
OBJS-$(CONFIG_VAAPI) += vaapi.o OBJS-$(CONFIG_VAAPI) += vaapi.o
OBJS-$(CONFIG_VDA) += vda.o
OBJS-$(CONFIG_VDPAU) += vdpau.o OBJS-$(CONFIG_VDPAU) += vdpau.o
OBJS-$(CONFIG_VIDEODSP) += videodsp.o OBJS-$(CONFIG_VIDEODSP) += videodsp.o
OBJS-$(CONFIG_VP3DSP) += vp3dsp.o OBJS-$(CONFIG_VP3DSP) += vp3dsp.o
......
...@@ -79,6 +79,7 @@ void avcodec_register_all(void) ...@@ -79,6 +79,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2); REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_VAAPI, h264_vaapi); REGISTER_HWACCEL(H264_VAAPI, h264_vaapi);
REGISTER_HWACCEL(H264_VDA, h264_vda); REGISTER_HWACCEL(H264_VDA, h264_vda);
REGISTER_HWACCEL(H264_VDA_OLD, h264_vda_old);
REGISTER_HWACCEL(H264_VDPAU, h264_vdpau); REGISTER_HWACCEL(H264_VDPAU, h264_vdpau);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc); REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau); REGISTER_HWACCEL(MPEG1_VDPAU, mpeg1_vdpau);
......
...@@ -157,6 +157,7 @@ static const enum AVPixelFormat h264_hwaccel_pixfmt_list_420[] = { ...@@ -157,6 +157,7 @@ static const enum AVPixelFormat h264_hwaccel_pixfmt_list_420[] = {
#endif #endif
#if CONFIG_H264_VDA_HWACCEL #if CONFIG_H264_VDA_HWACCEL
AV_PIX_FMT_VDA_VLD, AV_PIX_FMT_VDA_VLD,
AV_PIX_FMT_VDA,
#endif #endif
#if CONFIG_H264_VDPAU_HWACCEL #if CONFIG_H264_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU, AV_PIX_FMT_VDPAU,
...@@ -174,6 +175,7 @@ static const enum AVPixelFormat h264_hwaccel_pixfmt_list_jpeg_420[] = { ...@@ -174,6 +175,7 @@ static const enum AVPixelFormat h264_hwaccel_pixfmt_list_jpeg_420[] = {
#endif #endif
#if CONFIG_H264_VDA_HWACCEL #if CONFIG_H264_VDA_HWACCEL
AV_PIX_FMT_VDA_VLD, AV_PIX_FMT_VDA_VLD,
AV_PIX_FMT_VDA,
#endif #endif
#if CONFIG_H264_VDPAU_HWACCEL #if CONFIG_H264_VDPAU_HWACCEL
AV_PIX_FMT_VDPAU, AV_PIX_FMT_VDPAU,
......
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/mem.h"
#include "vda.h"
#include "vda_internal.h"
#if CONFIG_H264_VDA_HWACCEL
AVVDAContext *av_vda_alloc_context(void)
{
AVVDAContext *ret = av_mallocz(sizeof(*ret));
if (ret)
ret->output_callback = ff_vda_output_callback;
return ret;
}
int av_vda_default_init(AVCodecContext *avctx)
{
avctx->hwaccel_context = av_vda_alloc_context();
if (!avctx->hwaccel_context)
return AVERROR(ENOMEM);
return ff_vda_default_init(avctx);
}
void av_vda_default_free(AVCodecContext *avctx)
{
ff_vda_default_free(avctx);
av_freep(&avctx->hwaccel_context);
}
void ff_vda_default_free(AVCodecContext *avctx)
{
AVVDAContext *vda = avctx->hwaccel_context;
if (vda && vda->decoder)
VDADecoderDestroy(vda->decoder);
}
#else
AVVDAContext *av_vda_alloc_context(void)
{
return NULL;
}
int av_vda_default_init(AVCodecContext *avctx)
{
return AVERROR(ENOSYS);
}
void av_vda_default_free(AVCodecContext *ctx)
{
}
#endif
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
* Public libavcodec VDA header. * Public libavcodec VDA header.
*/ */
#include "libavcodec/avcodec.h"
#include <stdint.h> #include <stdint.h>
// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes // emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes
...@@ -152,6 +154,58 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx, ...@@ -152,6 +154,58 @@ int ff_vda_create_decoder(struct vda_context *vda_ctx,
/** Destroy the video decoder. */ /** Destroy the video decoder. */
int ff_vda_destroy_decoder(struct vda_context *vda_ctx); int ff_vda_destroy_decoder(struct vda_context *vda_ctx);
/**
* This struct holds all the information that needs to be passed
* between the caller and libavcodec for initializing VDA decoding.
* Its size is not a part of the public ABI, it must be allocated with
* av_vda_alloc_context() and freed with av_free().
*/
typedef struct AVVDAContext {
/**
* VDA decoder object. Created and freed by the caller.
*/
VDADecoder decoder;
/**
* The output callback that must be passed to VDADecoderCreate.
* Set by av_vda_alloc_context().
*/
VDADecoderOutputCallback output_callback;
} AVVDAContext;
/**
* Allocate and initialize a VDA context.
*
* This function should be called from the get_format() callback when the caller
* selects the AV_PIX_FMT_VDA format. The caller must then create the decoder
* object (using the output callback provided by libavcodec) that will be used
* for VDA-accelerated decoding.
*
* When decoding with VDA is finished, the caller must destroy the decoder
* object and free the VDA context using av_free().
*
* @return the newly allocated context or NULL on failure
*/
AVVDAContext *av_vda_alloc_context(void);
/**
* This is a convenience function that creates and sets up the VDA context using
* an internal implementation.
*
* @param avctx the corresponding codec context
*
* @return >= 0 on success, a negative AVERROR code on failure
*/
int av_vda_default_init(AVCodecContext *avctx);
/**
* This function must be called to free the VDA context initialized with
* av_vda_default_init().
*
* @param avctx the corresponding codec context
*/
void av_vda_default_free(AVCodecContext *avctx);
/** /**
* @} * @}
*/ */
......
This diff is collapsed.
/*
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* FFmpeg is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVCODEC_VDA_INTERNAL_H
#define AVCODEC_VDA_INTERNAL_H
#include "vda.h"
void ff_vda_output_callback(void *vda_hw_ctx,
CFDictionaryRef user_info,
OSStatus status,
uint32_t infoFlags,
CVImageBufferRef image_buffer);
int ff_vda_default_init(AVCodecContext *avctx);
void ff_vda_default_free(AVCodecContext *avctx);
#endif /* AVCODEC_VDA_INTERNAL_H */
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