FFmpeg
Macros | Functions | Variables
qsv.c File Reference
#include <mfx/mfxvideo.h>
#include <mfx/mfxplugin.h>
#include <mfx/mfxjpeg.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/avstring.h"
#include "libavutil/common.h"
#include "libavutil/error.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_qsv.h"
#include "libavutil/imgutils.h"
#include "libavutil/avassert.h"
#include "avcodec.h"
#include "qsv_internal.h"

Go to the source code of this file.

Macros

#define MAP(c, p, v)   { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }
 

Functions

int ff_qsv_codec_id_to_mfx (enum AVCodecID codec_id)
 
int ff_qsv_profile_to_mfx (enum AVCodecID codec_id, int profile)
 
int ff_qsv_level_to_mfx (enum AVCodecID codec_id, int level)
 
int ff_qsv_print_iopattern (void *log_ctx, int mfx_iopattern, const char *extra_string)
 
int ff_qsv_map_error (mfxStatus mfx_err, const char **desc)
 Convert a libmfx error code into an ffmpeg error code. More...
 
int ff_qsv_print_error (void *log_ctx, mfxStatus err, const char *error_string)
 
int ff_qsv_print_warning (void *log_ctx, mfxStatus err, const char *warning_string)
 
enum AVPixelFormat ff_qsv_map_fourcc (uint32_t fourcc)
 
int ff_qsv_map_pixfmt (enum AVPixelFormat format, uint32_t *fourcc)
 
int ff_qsv_find_surface_idx (QSVFramesContext *ctx, QSVFrame *frame)
 
enum AVFieldOrder ff_qsv_map_picstruct (int mfx_pic_struct)
 
enum AVPictureType ff_qsv_map_pictype (int mfx_pic_type)
 
static int qsv_load_plugins (mfxSession session, const char *load_plugins, void *logctx)
 
int ff_qsv_init_internal_session (AVCodecContext *avctx, QSVSession *qs, const char *load_plugins, int gpu_copy)
 
static void mids_buf_free (void *opaque, uint8_t *data)
 
static AVBufferRefqsv_create_mids (AVBufferRef *hw_frames_ref)
 
static int qsv_setup_mids (mfxFrameAllocResponse *resp, AVBufferRef *hw_frames_ref, AVBufferRef *mids_buf)
 
static mfxStatus qsv_frame_alloc (mfxHDL pthis, mfxFrameAllocRequest *req, mfxFrameAllocResponse *resp)
 
static mfxStatus qsv_frame_free (mfxHDL pthis, mfxFrameAllocResponse *resp)
 
static mfxStatus qsv_frame_lock (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
 
static mfxStatus qsv_frame_unlock (mfxHDL pthis, mfxMemId mid, mfxFrameData *ptr)
 
static mfxStatus qsv_frame_get_hdl (mfxHDL pthis, mfxMemId mid, mfxHDL *hdl)
 
int ff_qsv_init_session_device (AVCodecContext *avctx, mfxSession *psession, AVBufferRef *device_ref, const char *load_plugins, int gpu_copy)
 
int ff_qsv_init_session_frames (AVCodecContext *avctx, mfxSession *psession, QSVFramesContext *qsv_frames_ctx, const char *load_plugins, int opaque, int gpu_copy)
 
int ff_qsv_close_internal_session (QSVSession *qs)
 

Variables

struct {
   enum AVCodecID   codec_id
 
   int   codec_profile
 
   int   mfx_profile
 
qsv_profile_map []
 
struct {
   int   mfx_iopattern
 
   const char *   desc
 
qsv_iopatterns []
 
struct {
   mfxStatus   mfxerr
 
   int   averr
 
   const char *   desc
 
qsv_errors []
 

Macro Definition Documentation

#define MAP (   c,
  p,
 
)    { AV_CODEC_ID_ ## c, FF_PROFILE_ ## p, MFX_PROFILE_ ## v }

Function Documentation

int ff_qsv_codec_id_to_mfx ( enum AVCodecID  codec_id)

Definition at line 43 of file qsv.c.

Referenced by init_video_param(), init_video_param_jpeg(), and qsv_decode_header().

int ff_qsv_profile_to_mfx ( enum AVCodecID  codec_id,
int  profile 
)

Definition at line 111 of file qsv.c.

int ff_qsv_level_to_mfx ( enum AVCodecID  codec_id,
int  level 
)

Definition at line 127 of file qsv.c.

int ff_qsv_print_iopattern ( void log_ctx,
int  mfx_iopattern,
const char *  extra_string 
)

Definition at line 152 of file qsv.c.

Referenced by qsv_decode_preinit().

int ff_qsv_map_error ( mfxStatus  mfx_err,
const char **  desc 
)

Convert a libmfx error code into an ffmpeg error code.

Definition at line 209 of file qsv.c.

Referenced by ff_qsv_print_error(), and ff_qsv_print_warning().

int ff_qsv_print_error ( void log_ctx,
mfxStatus  err,
const char *  error_string 
)
int ff_qsv_print_warning ( void log_ctx,
mfxStatus  err,
const char *  warning_string 
)

Definition at line 234 of file qsv.c.

Referenced by encode_frame(), ff_qsv_enc_init(), and qsv_decode().

enum AVPixelFormat ff_qsv_map_fourcc ( uint32_t  fourcc)

Definition at line 244 of file qsv.c.

Referenced by ff_qsv_process_data(), qsv_decode_init(), and qsv_frame_alloc().

int ff_qsv_map_pixfmt ( enum AVPixelFormat  format,
uint32_t *  fourcc 
)

Definition at line 254 of file qsv.c.

Referenced by init_video_param(), and init_video_param_jpeg().

int ff_qsv_find_surface_idx ( QSVFramesContext ctx,
QSVFrame frame 
)

Definition at line 271 of file qsv.c.

Referenced by alloc_frame(), and submit_frame().

enum AVFieldOrder ff_qsv_map_picstruct ( int  mfx_pic_struct)

Definition at line 282 of file qsv.c.

Referenced by qsv_decode_init().

enum AVPictureType ff_qsv_map_pictype ( int  mfx_pic_type)

Definition at line 300 of file qsv.c.

Referenced by qsv_decode().

static int qsv_load_plugins ( mfxSession  session,
const char *  load_plugins,
void logctx 
)
static

Definition at line 329 of file qsv.c.

Referenced by ff_qsv_init_internal_session(), and ff_qsv_init_session_device().

int ff_qsv_init_internal_session ( AVCodecContext avctx,
QSVSession qs,
const char *  load_plugins,
int  gpu_copy 
)

Definition at line 414 of file qsv.c.

Referenced by qsv_init_session(), and qsvenc_init_session().

static void mids_buf_free ( void opaque,
uint8_t data 
)
static

Definition at line 469 of file qsv.c.

Referenced by qsv_create_mids().

static AVBufferRef* qsv_create_mids ( AVBufferRef hw_frames_ref)
static

Definition at line 476 of file qsv.c.

Referenced by ff_qsv_init_session_frames(), and qsv_frame_alloc().

static int qsv_setup_mids ( mfxFrameAllocResponse *  resp,
AVBufferRef hw_frames_ref,
AVBufferRef mids_buf 
)
static

Definition at line 513 of file qsv.c.

Referenced by qsv_frame_alloc().

static mfxStatus qsv_frame_alloc ( mfxHDL  pthis,
mfxFrameAllocRequest *  req,
mfxFrameAllocResponse *  resp 
)
static

Definition at line 549 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

static mfxStatus qsv_frame_free ( mfxHDL  pthis,
mfxFrameAllocResponse *  resp 
)
static

Definition at line 638 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

static mfxStatus qsv_frame_lock ( mfxHDL  pthis,
mfxMemId  mid,
mfxFrameData *  ptr 
)
static

Definition at line 646 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

static mfxStatus qsv_frame_unlock ( mfxHDL  pthis,
mfxMemId  mid,
mfxFrameData *  ptr 
)
static

Definition at line 703 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

static mfxStatus qsv_frame_get_hdl ( mfxHDL  pthis,
mfxMemId  mid,
mfxHDL *  hdl 
)
static

Definition at line 713 of file qsv.c.

Referenced by ff_qsv_init_session_frames().

int ff_qsv_init_session_device ( AVCodecContext avctx,
mfxSession *  psession,
AVBufferRef device_ref,
const char *  load_plugins,
int  gpu_copy 
)

Definition at line 720 of file qsv.c.

Referenced by ff_qsv_init_session_frames(), qsv_init_session(), and qsvenc_init_session().

int ff_qsv_init_session_frames ( AVCodecContext avctx,
mfxSession *  psession,
QSVFramesContext qsv_frames_ctx,
const char *  load_plugins,
int  opaque,
int  gpu_copy 
)

Definition at line 797 of file qsv.c.

Referenced by qsv_init_session(), and qsvenc_init_session().

int ff_qsv_close_internal_session ( QSVSession qs)

Definition at line 844 of file qsv.c.

Referenced by ff_qsv_decode_close(), and ff_qsv_enc_close().

Variable Documentation

enum AVCodecID codec_id
int codec_profile

Definition at line 78 of file qsv.c.

Referenced by ff_qsv_profile_to_mfx().

int mfx_profile

Definition at line 79 of file qsv.c.

const { ... } qsv_profile_map[]
Initial value:
= {
#define MAP(c, p, v)
MAP(MPEG2VIDEO, MPEG2_SIMPLE, MPEG2_SIMPLE ),
MAP(MPEG2VIDEO, MPEG2_MAIN, MPEG2_MAIN ),
MAP(MPEG2VIDEO, MPEG2_HIGH, MPEG2_HIGH ),
MAP(H264, H264_BASELINE, AVC_BASELINE ),
MAP(H264, H264_CONSTRAINED_BASELINE, AVC_BASELINE),
MAP(H264, H264_MAIN, AVC_MAIN ),
MAP(H264, H264_HIGH, AVC_HIGH ),
MAP(H264, H264_HIGH_422, AVC_HIGH_422 ),
MAP(VC1, VC1_SIMPLE, VC1_SIMPLE ),
MAP(VC1, VC1_MAIN, VC1_MAIN ),
MAP(VC1, VC1_COMPLEX, VC1_ADVANCED ),
MAP(VC1, VC1_ADVANCED, VC1_ADVANCED ),
}
#define MAP(c, p, v)

Referenced by ff_qsv_profile_to_mfx().

int mfx_iopattern

Definition at line 141 of file qsv.c.

const char* desc
const { ... } qsv_iopatterns[]
Initial value:
= {
{MFX_IOPATTERN_IN_VIDEO_MEMORY, "input is video memory surface" },
{MFX_IOPATTERN_IN_SYSTEM_MEMORY, "input is system memory surface" },
{MFX_IOPATTERN_IN_OPAQUE_MEMORY, "input is opaque memory surface" },
{MFX_IOPATTERN_OUT_VIDEO_MEMORY, "output is video memory surface" },
{MFX_IOPATTERN_OUT_SYSTEM_MEMORY, "output is system memory surface" },
{MFX_IOPATTERN_OUT_OPAQUE_MEMORY, "output is opaque memory surface" },
}

Referenced by ff_qsv_print_iopattern().

mfxStatus mfxerr

Definition at line 170 of file qsv.c.

Referenced by ff_qsv_map_error().

int averr

Definition at line 171 of file qsv.c.

const { ... } qsv_errors[]

Referenced by ff_qsv_map_error().