diff options
author | John Stebbins <[email protected]> | 2016-12-12 13:16:36 -0800 |
---|---|---|
committer | John Stebbins <[email protected]> | 2016-12-17 07:28:51 -0800 |
commit | 480d018ee0012a5adb9609195a951496f7d3c62a (patch) | |
tree | f0b79cbde2042111a8005c45fd3e67cbddada1a3 /libhb/qsv_libav.h | |
parent | a4a6332a90b21eb246b5147dc3285b36cd6f631e (diff) |
qsv: rename av_qsv* to hb_qsv*
Diffstat (limited to 'libhb/qsv_libav.h')
-rw-r--r-- | libhb/qsv_libav.h | 222 |
1 files changed, 111 insertions, 111 deletions
diff --git a/libhb/qsv_libav.h b/libhb/qsv_libav.h index 779571022..38f89e410 100644 --- a/libhb/qsv_libav.h +++ b/libhb/qsv_libav.h @@ -69,7 +69,7 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - details: * "per slice" support: AV_PIX_FMT_QSV with AVHWAccel based implementation * - * Note av_qsv_config struct required to fill in via + * Note hb_qsv_config struct required to fill in via * AVCodecContext.hwaccel_context * * As per frame, note AVFrame.data[2] (qsv_atom) used for frame atom id, @@ -86,19 +86,19 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * Target OS: as per available dispatcher and driver support * * Implementation details: - * Provided struct av_qsv_context contain several struct av_qsv_space(s) for decode, + * Provided struct hb_qsv_context contain several struct hb_qsv_space(s) for decode, * VPP and encode. - * av_qsv_space just contain needed environment for the appropriate action. + * hb_qsv_space just contain needed environment for the appropriate action. * Based on this - pipeline (see pipes) will be build to pass details such as * mfxFrameSurface1* and mfxSyncPoint* from one action to the next. * - * Resources re-usage (av_qsv_flush_stages): - * av_qsv_context *qsv = (av_qsv_context *)video_codec_ctx->priv_data; - * av_qsv_list *pipe = (av_qsv_list *)video_frame->data[2]; - * av_qsv_flush_stages( qsv->pipes, &pipe ); + * Resources re-usage (hb_qsv_flush_stages): + * hb_qsv_context *qsv = (hb_qsv_context *)video_codec_ctx->priv_data; + * hb_qsv_list *pipe = (hb_qsv_list *)video_frame->data[2]; + * hb_qsv_flush_stages( qsv->pipes, &pipe ); * * DTS re-usage: - * av_qsv_dts_pop(qsv); + * hb_qsv_dts_pop(qsv); * * for video,DX9/11 memory it has to be Unlock'ed as well * @@ -108,8 +108,8 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * For the details of MediaSDK usage and options available - please refer to the * available documentation at MediaSDK. * - * Feature set used from MSDK is defined by AV_QSV_MSDK_VERSION_MAJOR and - * AV_QSV_MSDK_VERSION_MINOR + * Feature set used from MSDK is defined by HB_QSV_MSDK_VERSION_MAJOR and + * HB_QSV_MSDK_VERSION_MINOR * * @{ */ @@ -137,58 +137,58 @@ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // sleep is defined in milliseconds -#define av_qsv_sleep(x) av_usleep((x)*1000) +#define hb_qsv_sleep(x) av_usleep((x)*1000) -#define AV_QSV_ZERO_MEMORY(VAR) {memset(&VAR, 0, sizeof(VAR));} -#define AV_QSV_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31)) -#define AV_QSV_ALIGN16(value) (((value + 15) >> 4) << 4) -#ifndef AV_QSV_PRINT_RET_MSG -#define AV_QSV_PRINT_RET_MSG(ERR) { fprintf(stderr, "Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); } +#define HB_QSV_ZERO_MEMORY(VAR) {memset(&VAR, 0, sizeof(VAR));} +#define HB_QSV_ALIGN32(X) (((mfxU32)((X)+31)) & (~ (mfxU32)31)) +#define HB_QSV_ALIGN16(value) (((value + 15) >> 4) << 4) +#ifndef HB_QSV_PRINT_RET_MSG +#define HB_QSV_PRINT_RET_MSG(ERR) { fprintf(stderr, "Error code %d,\t%s\t%d\n", ERR, __FUNCTION__, __LINE__); } #endif -#ifndef AV_QSV_DEBUG_ASSERT -#define AV_QSV_DEBUG_ASSERT(x,y) { if ((x)) { fprintf(stderr, "\nASSERT: %s\n", y); } } +#ifndef HB_QSV_DEBUG_ASSERT +#define HB_QSV_DEBUG_ASSERT(x,y) { if ((x)) { fprintf(stderr, "\nASSERT: %s\n", y); } } #endif -#define AV_QSV_CHECK_RET(P, X, ERR) {if ((X) > (P)) {AV_QSV_PRINT_RET_MSG(ERR); return;}} -#define AV_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}} -#define AV_QSV_CHECK_POINTER(P, ERR) {if (!(P)) {AV_QSV_PRINT_RET_MSG(ERR); return ERR;}} -#define AV_QSV_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}} +#define HB_QSV_CHECK_RET(P, X, ERR) {if ((X) > (P)) {HB_QSV_PRINT_RET_MSG(ERR); return;}} +#define HB_QSV_CHECK_RESULT(P, X, ERR) {if ((X) > (P)) {HB_QSV_PRINT_RET_MSG(ERR); return ERR;}} +#define HB_QSV_CHECK_POINTER(P, ERR) {if (!(P)) {HB_QSV_PRINT_RET_MSG(ERR); return ERR;}} +#define HB_QSV_IGNORE_MFX_STS(P, X) {if ((X) == (P)) {P = MFX_ERR_NONE;}} -#define AV_QSV_ID_BUFFER MFX_MAKEFOURCC('B','U','F','F') -#define AV_QSV_ID_FRAME MFX_MAKEFOURCC('F','R','M','E') +#define HB_QSV_ID_BUFFER MFX_MAKEFOURCC('B','U','F','F') +#define HB_QSV_ID_FRAME MFX_MAKEFOURCC('F','R','M','E') -#define AV_QSV_SURFACE_NUM 80 -#define AV_QSV_SYNC_NUM AV_QSV_SURFACE_NUM*3/4 -#define AV_QSV_BUF_SIZE_DEFAULT 4096*2160*10 -#define AV_QSV_JOB_SIZE_DEFAULT 10 -#define AV_QSV_SYNC_TIME_DEFAULT 10000 -// see av_qsv_get_free_sync, av_qsv_get_free_surface , 100 if usleep(10*1000)(10ms) == 1 sec -#define AV_QSV_REPEAT_NUM_DEFAULT 100 -#define AV_QSV_ASYNC_DEPTH_DEFAULT 4 +#define HB_QSV_SURFACE_NUM 80 +#define HB_QSV_SYNC_NUM HB_QSV_SURFACE_NUM*3/4 +#define HB_QSV_BUF_SIZE_DEFAULT 4096*2160*10 +#define HB_QSV_JOB_SIZE_DEFAULT 10 +#define HB_QSV_SYNC_TIME_DEFAULT 10000 +// see hb_qsv_get_free_sync, hb_qsv_get_free_surface , 100 if usleep(10*1000)(10ms) == 1 sec +#define HB_QSV_REPEAT_NUM_DEFAULT 100 +#define HB_QSV_ASYNC_DEPTH_DEFAULT 4 // version of MSDK/QSV API currently used -#define AV_QSV_MSDK_VERSION_MAJOR 1 -#define AV_QSV_MSDK_VERSION_MINOR 3 +#define HB_QSV_MSDK_VERSION_MAJOR 1 +#define HB_QSV_MSDK_VERSION_MINOR 3 -typedef enum AV_QSV_STAGE_TYPE { +typedef enum HB_QSV_STAGE_TYPE { -#define AV_QSV_DECODE_MASK 0x001 - AV_QSV_DECODE = 0x001, +#define HB_QSV_DECODE_MASK 0x001 + HB_QSV_DECODE = 0x001, -#define AV_QSV_VPP_MASK 0x0F0 +#define HB_QSV_VPP_MASK 0x0F0 // "Mandatory VPP filter" , might be with "Hint-based VPP filters" - AV_QSV_VPP_DEFAULT = 0x010, + HB_QSV_VPP_DEFAULT = 0x010, // "User Modules" etc - AV_QSV_VPP_USER = 0x020, + HB_QSV_VPP_USER = 0x020, #define av_QSV_ENCODE_MASK 0x100 - AV_QSV_ENCODE = 0x100 -#define AV_QSV_ANY_MASK 0xFFF -} AV_QSV_STAGE_TYPE; + HB_QSV_ENCODE = 0x100 +#define HB_QSV_ANY_MASK 0xFFF +} HB_QSV_STAGE_TYPE; -typedef struct av_qsv_list { +typedef struct hb_qsv_list { // practically pthread_mutex_t void *mutex; pthread_mutexattr_t mta; @@ -197,15 +197,15 @@ typedef struct av_qsv_list { int items_alloc; int items_count; -} av_qsv_list; +} hb_qsv_list; -typedef struct av_qsv_sync { +typedef struct hb_qsv_sync { mfxSyncPoint* p_sync; int in_use; -} av_qsv_sync; +} hb_qsv_sync; -typedef struct av_qsv_stage { - AV_QSV_STAGE_TYPE type; +typedef struct hb_qsv_stage { + HB_QSV_STAGE_TYPE type; struct { mfxBitstream *p_bs; mfxFrameSurface1 *p_surface; @@ -213,22 +213,22 @@ typedef struct av_qsv_stage { struct { mfxBitstream *p_bs; mfxFrameSurface1 *p_surface; - av_qsv_sync *sync; + hb_qsv_sync *sync; } out; - av_qsv_list *pending; -} av_qsv_stage; + hb_qsv_list *pending; +} hb_qsv_stage; -typedef struct av_qsv_task { +typedef struct hb_qsv_task { mfxBitstream *bs; - av_qsv_stage *stage; -} av_qsv_task; + hb_qsv_stage *stage; +} hb_qsv_task; -typedef struct av_qsv_space { +typedef struct hb_qsv_space { uint8_t is_init_done; - AV_QSV_STAGE_TYPE type; + HB_QSV_STAGE_TYPE type; mfxVideoParam m_mfxVideoParam; @@ -241,26 +241,26 @@ typedef struct av_qsv_space { uint16_t surface_num_max_used; uint16_t surface_num; - mfxFrameSurface1 *p_surfaces[AV_QSV_SURFACE_NUM]; + mfxFrameSurface1 *p_surfaces[HB_QSV_SURFACE_NUM]; uint16_t sync_num_max_used; uint16_t sync_num; - av_qsv_sync *p_syncp[AV_QSV_SYNC_NUM]; + hb_qsv_sync *p_syncp[HB_QSV_SYNC_NUM]; mfxBitstream bs; uint8_t *p_buf; size_t p_buf_max_size; // only for encode and tasks - av_qsv_list *tasks; + hb_qsv_list *tasks; - av_qsv_list *pending; + hb_qsv_list *pending; // storage for allocations/mfxMemId* mfxMemId *mids; -} av_qsv_space; +} hb_qsv_space; -typedef struct av_qsv_context { +typedef struct hb_qsv_context { volatile int is_context_active; mfxIMPL impl; @@ -268,18 +268,18 @@ typedef struct av_qsv_context { mfxVersion ver; // decode - av_qsv_space *dec_space; + hb_qsv_space *dec_space; // encode - av_qsv_space *enc_space; + hb_qsv_space *enc_space; // vpp - av_qsv_list *vpp_space; + hb_qsv_list *vpp_space; - av_qsv_list *pipes; + hb_qsv_list *pipes; // MediaSDK starting from API version 1.6 includes DecodeTimeStamp // in addition to TimeStamp - // see also AV_QSV_MSDK_VERSION_MINOR , AV_QSV_MSDK_VERSION_MAJOR - av_qsv_list *dts_seq; + // see also HB_QSV_MSDK_VERSION_MINOR , HB_QSV_MSDK_VERSION_MAJOR + hb_qsv_list *dts_seq; // practically pthread_mutex_t void *qts_seq_mutex; @@ -288,36 +288,36 @@ typedef struct av_qsv_context { void *qsv_config; -} av_qsv_context; +} hb_qsv_context; typedef enum { QSV_PART_ANY = 0, QSV_PART_LOWER, QSV_PART_UPPER -} av_qsv_split; +} hb_qsv_split; typedef struct { int64_t dts; -} av_qsv_dts; +} hb_qsv_dts; -typedef struct av_qsv_alloc_frame { +typedef struct hb_qsv_alloc_frame { mfxU32 id; mfxFrameInfo info; -} av_qsv_alloc_frame; +} hb_qsv_alloc_frame; -typedef struct av_qsv_alloc_buffer { +typedef struct hb_qsv_alloc_buffer { mfxU32 id; mfxU32 nbytes; mfxU16 type; -} av_qsv_alloc_buffer; +} hb_qsv_alloc_buffer; -typedef struct av_qsv_allocators_space { - av_qsv_space *space; +typedef struct hb_qsv_allocators_space { + hb_qsv_space *space; mfxFrameAllocator frame_alloc; mfxBufferAllocator buffer_alloc; -} av_qsv_allocators_space; +} hb_qsv_allocators_space; -typedef struct av_qsv_config { +typedef struct hb_qsv_config { /** * Set asynch depth of processing with QSV * Format: 0 and more @@ -385,7 +385,7 @@ typedef struct av_qsv_config { /** * If pipeline should be sync. * Format: wait time in milliseconds, - * AV_QSV_SYNC_TIME_DEFAULT/10000 might be a good value + * HB_QSV_SYNC_TIME_DEFAULT/10000 might be a good value * * - encoding: Set by user. * - decoding: Set by user. @@ -427,9 +427,9 @@ typedef struct av_qsv_config { * - encoding: Set by user. * - decoding: Set by user. */ - av_qsv_allocators_space *allocators; + hb_qsv_allocators_space *allocators; -} av_qsv_config; +} hb_qsv_config; #define ANEX_UNKNOWN 0 #define ANEX_PREFIX 1 @@ -437,44 +437,44 @@ typedef struct av_qsv_config { static const uint8_t ff_prefix_code[] = { 0x00, 0x00, 0x00, 0x01 }; -int av_qsv_get_free_sync(av_qsv_space *, av_qsv_context *); -int av_qsv_get_free_surface(av_qsv_space *, av_qsv_context *, mfxFrameInfo *, - av_qsv_split); -int av_qsv_get_free_encode_task(av_qsv_list *); +int hb_qsv_get_free_sync(hb_qsv_space *, hb_qsv_context *); +int hb_qsv_get_free_surface(hb_qsv_space *, hb_qsv_context *, mfxFrameInfo *, + hb_qsv_split); +int hb_qsv_get_free_encode_task(hb_qsv_list *); int av_is_qsv_available(mfxIMPL, mfxVersion *); -void av_qsv_wait_on_sync(av_qsv_context *, av_qsv_stage *); +void hb_qsv_wait_on_sync(hb_qsv_context *, hb_qsv_stage *); -void av_qsv_add_context_usage(av_qsv_context *, int); +void hb_qsv_add_context_usage(hb_qsv_context *, int); -void av_qsv_pipe_list_create(av_qsv_list **, int); -void av_qsv_pipe_list_clean(av_qsv_list **); +void hb_qsv_pipe_list_create(hb_qsv_list **, int); +void hb_qsv_pipe_list_clean(hb_qsv_list **); -void av_qsv_add_stagee(av_qsv_list **, av_qsv_stage *, int); -av_qsv_stage *av_qsv_get_last_stage(av_qsv_list *); -av_qsv_list *av_qsv_pipe_by_stage(av_qsv_list *, av_qsv_stage *); -void av_qsv_flush_stages(av_qsv_list *, av_qsv_list **); +void hb_qsv_add_stagee(hb_qsv_list **, hb_qsv_stage *, int); +hb_qsv_stage *hb_qsv_get_last_stage(hb_qsv_list *); +hb_qsv_list *hb_qsv_pipe_by_stage(hb_qsv_list *, hb_qsv_stage *); +void hb_qsv_flush_stages(hb_qsv_list *, hb_qsv_list **); -void av_qsv_dts_ordered_insert(av_qsv_context *, int, int, int64_t, int); -void av_qsv_dts_pop(av_qsv_context *); +void hb_qsv_dts_ordered_insert(hb_qsv_context *, int, int, int64_t, int); +void hb_qsv_dts_pop(hb_qsv_context *); -av_qsv_stage *av_qsv_stage_init(void); -void av_qsv_stage_clean(av_qsv_stage **); -int av_qsv_context_clean(av_qsv_context *); +hb_qsv_stage *hb_qsv_stage_init(void); +void hb_qsv_stage_clean(hb_qsv_stage **); +int hb_qsv_context_clean(hb_qsv_context *); -int ff_qsv_is_sync_in_pipe(mfxSyncPoint *, av_qsv_context *); -int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 *, av_qsv_context *); +int ff_qsv_is_sync_in_pipe(mfxSyncPoint *, hb_qsv_context *); +int ff_qsv_is_surface_in_pipe(mfxFrameSurface1 *, hb_qsv_context *); -av_qsv_list *av_qsv_list_init(int); -int av_qsv_list_lock(av_qsv_list *); -int av_qsv_list_unlock(av_qsv_list *); -int av_qsv_list_add(av_qsv_list *, void *); -void av_qsv_list_rem(av_qsv_list *, void *); -void av_qsv_list_insert(av_qsv_list *, int, void *); -void av_qsv_list_close(av_qsv_list **); +hb_qsv_list *hb_qsv_list_init(int); +int hb_qsv_list_lock(hb_qsv_list *); +int hb_qsv_list_unlock(hb_qsv_list *); +int hb_qsv_list_add(hb_qsv_list *, void *); +void hb_qsv_list_rem(hb_qsv_list *, void *); +void hb_qsv_list_insert(hb_qsv_list *, int, void *); +void hb_qsv_list_close(hb_qsv_list **); -int av_qsv_list_count(av_qsv_list *); -void *av_qsv_list_item(av_qsv_list *, int); +int hb_qsv_list_count(hb_qsv_list *); +void *hb_qsv_list_item(hb_qsv_list *, int); /* @} */ |