FFmpeg
Data Structures | Macros | Enumerations | Functions | Variables
vf_transpose_npp.c File Reference
#include <nppi.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/hwcontext.h"
#include "libavutil/hwcontext_cuda_internal.h"
#include "libavutil/cuda_check.h"
#include "libavutil/internal.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  NPPTransposeStageContext
 
struct  NPPTransposeContext
 

Macros

#define CHECK_CU(x)   FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)
 
#define OFFSET(x)   offsetof(NPPTransposeContext, x)
 
#define FLAGS   (AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM)
 

Enumerations

enum  TransposeStage { STAGE_ROTATE, STAGE_TRANSPOSE, STAGE_NB }
 
enum  Transpose { NPP_TRANSPOSE_CCLOCK_FLIP = 0, NPP_TRANSPOSE_CLOCK = 1, NPP_TRANSPOSE_CCLOCK = 2, NPP_TRANSPOSE_CLOCK_FLIP = 3 }
 
enum  Passthrough { NPP_TRANSPOSE_PT_TYPE_NONE = 0, NPP_TRANSPOSE_PT_TYPE_LANDSCAPE, NPP_TRANSPOSE_PT_TYPE_PORTRAIT }
 

Functions

static int npptranspose_init (AVFilterContext *ctx)
 
static void npptranspose_uninit (AVFilterContext *ctx)
 
static int init_stage (NPPTransposeStageContext *stage, AVBufferRef *device_ctx)
 
static int format_is_supported (enum AVPixelFormat fmt)
 
static int init_processing_chain (AVFilterContext *ctx, int in_width, int in_height, int out_width, int out_height)
 
static int npptranspose_config_props (AVFilterLink *outlink)
 
static int npptranspose_rotate (AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
 
static int npptranspose_transpose (AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
 
static int npptranspose_filter (AVFilterContext *ctx, AVFrame *out, AVFrame *in)
 
static int npptranspose_filter_frame (AVFilterLink *link, AVFrame *in)
 

Variables

static enum AVPixelFormat supported_formats []
 
static int(*const npptranspose_process [])(AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
 
static const AVOption options []
 
static const AVClass npptranspose_class
 
static const AVFilterPad npptranspose_inputs []
 
static const AVFilterPad npptranspose_outputs []
 
const AVFilter ff_vf_transpose_npp
 

Macro Definition Documentation

◆ CHECK_CU

#define CHECK_CU (   x)    FF_CUDA_CHECK_DL(ctx, device_hwctx->internal->cuda_dl, x)

Definition at line 36 of file vf_transpose_npp.c.

◆ OFFSET

#define OFFSET (   x)    offsetof(NPPTransposeContext, x)

Definition at line 425 of file vf_transpose_npp.c.

◆ FLAGS

Definition at line 426 of file vf_transpose_npp.c.

Enumeration Type Documentation

◆ TransposeStage

Enumerator
STAGE_ROTATE 
STAGE_TRANSPOSE 
STAGE_NB 

Definition at line 43 of file vf_transpose_npp.c.

◆ Transpose

enum Transpose
Enumerator
NPP_TRANSPOSE_CCLOCK_FLIP 
NPP_TRANSPOSE_CLOCK 
NPP_TRANSPOSE_CCLOCK 
NPP_TRANSPOSE_CLOCK_FLIP 

Definition at line 49 of file vf_transpose_npp.c.

◆ Passthrough

Enumerator
NPP_TRANSPOSE_PT_TYPE_NONE 
NPP_TRANSPOSE_PT_TYPE_LANDSCAPE 
NPP_TRANSPOSE_PT_TYPE_PORTRAIT 

Definition at line 56 of file vf_transpose_npp.c.

Function Documentation

◆ npptranspose_init()

static int npptranspose_init ( AVFilterContext ctx)
static

Definition at line 83 of file vf_transpose_npp.c.

◆ npptranspose_uninit()

static void npptranspose_uninit ( AVFilterContext ctx)
static

Definition at line 101 of file vf_transpose_npp.c.

◆ init_stage()

static int init_stage ( NPPTransposeStageContext stage,
AVBufferRef device_ctx 
)
static

Definition at line 114 of file vf_transpose_npp.c.

Referenced by init_processing_chain().

◆ format_is_supported()

static int format_is_supported ( enum AVPixelFormat  fmt)
static

Definition at line 167 of file vf_transpose_npp.c.

Referenced by init_processing_chain().

◆ init_processing_chain()

static int init_processing_chain ( AVFilterContext ctx,
int  in_width,
int  in_height,
int  out_width,
int  out_height 
)
static

Definition at line 178 of file vf_transpose_npp.c.

Referenced by npptranspose_config_props().

◆ npptranspose_config_props()

static int npptranspose_config_props ( AVFilterLink outlink)
static

Definition at line 250 of file vf_transpose_npp.c.

◆ npptranspose_rotate()

static int npptranspose_rotate ( AVFilterContext ctx,
NPPTransposeStageContext stage,
AVFrame out,
AVFrame in 
)
static

Definition at line 288 of file vf_transpose_npp.c.

◆ npptranspose_transpose()

static int npptranspose_transpose ( AVFilterContext ctx,
NPPTransposeStageContext stage,
AVFrame out,
AVFrame in 
)
static

Definition at line 322 of file vf_transpose_npp.c.

◆ npptranspose_filter()

static int npptranspose_filter ( AVFilterContext ctx,
AVFrame out,
AVFrame in 
)
static

Definition at line 350 of file vf_transpose_npp.c.

Referenced by npptranspose_filter_frame().

◆ npptranspose_filter_frame()

static int npptranspose_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 385 of file vf_transpose_npp.c.

Variable Documentation

◆ supported_formats

enum AVPixelFormat supported_formats[]
static
Initial value:

Definition at line 38 of file vf_transpose_npp.c.

Referenced by format_is_supported().

◆ npptranspose_process

int(*const npptranspose_process[])(AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
static
Initial value:

Definition at line 344 of file vf_transpose_npp.c.

Referenced by npptranspose_filter().

◆ options

const AVOption options[]
static
Initial value:
= {
{ "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 3, FLAGS, "dir" },
{ "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK_FLIP }, 0, 0, FLAGS, "dir" },
{ "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK }, 0, 0, FLAGS, "dir" },
{ "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CCLOCK }, 0, 0, FLAGS, "dir" },
{ "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_CLOCK_FLIP }, 0, 0, FLAGS, "dir" },
{ "passthrough", "do not apply transposition if the input matches the specified geometry", OFFSET(passthrough), AV_OPT_TYPE_INT, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 2, FLAGS, "passthrough" },
{ "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_NONE }, 0, 0, FLAGS, "passthrough" },
{ "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_LANDSCAPE }, 0, 0, FLAGS, "passthrough" },
{ "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, { .i64 = NPP_TRANSPOSE_PT_TYPE_PORTRAIT }, 0, 0, FLAGS, "passthrough" },
{ NULL },
}

Definition at line 428 of file vf_transpose_npp.c.

◆ npptranspose_class

const AVClass npptranspose_class
static
Initial value:
= {
.class_name = "npptranspose",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 441 of file vf_transpose_npp.c.

◆ npptranspose_inputs

const AVFilterPad npptranspose_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = npptranspose_filter_frame,
},
}

Definition at line 448 of file vf_transpose_npp.c.

◆ npptranspose_outputs

const AVFilterPad npptranspose_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = npptranspose_config_props,
},
}

Definition at line 456 of file vf_transpose_npp.c.

◆ ff_vf_transpose_npp

const AVFilter ff_vf_transpose_npp
Initial value:
= {
.name = "transpose_npp",
.description = NULL_IF_CONFIG_SMALL("NVIDIA Performance Primitives video transpose"),
.priv_size = sizeof(NPPTransposeContext),
.priv_class = &npptranspose_class,
.flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
}

Definition at line 464 of file vf_transpose_npp.c.

AV_PIX_FMT_CUDA
@ AV_PIX_FMT_CUDA
HW acceleration through CUDA.
Definition: pixfmt.h:253
npptranspose_init
static int npptranspose_init(AVFilterContext *ctx)
Definition: vf_transpose_npp.c:83
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:374
npptranspose_class
static const AVClass npptranspose_class
Definition: vf_transpose_npp.c:441
options
static const AVOption options[]
Definition: vf_transpose_npp.c:428
npptranspose_config_props
static int npptranspose_config_props(AVFilterLink *outlink)
Definition: vf_transpose_npp.c:250
OFFSET
#define OFFSET(x)
Definition: vf_transpose_npp.c:425
NPP_TRANSPOSE_CLOCK
@ NPP_TRANSPOSE_CLOCK
Definition: vf_transpose_npp.c:51
npptranspose_rotate
static int npptranspose_rotate(AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_transpose_npp.c:288
AV_PIX_FMT_YUV420P
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:194
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
NPPTransposeContext
Definition: vf_transpose_npp.c:74
NPP_TRANSPOSE_PT_TYPE_PORTRAIT
@ NPP_TRANSPOSE_PT_TYPE_PORTRAIT
Definition: vf_transpose_npp.c:59
NPP_TRANSPOSE_CCLOCK
@ NPP_TRANSPOSE_CCLOCK
Definition: vf_transpose_npp.c:52
NPP_TRANSPOSE_PT_TYPE_LANDSCAPE
@ NPP_TRANSPOSE_PT_TYPE_LANDSCAPE
Definition: vf_transpose_npp.c:58
npptranspose_uninit
static void npptranspose_uninit(AVFilterContext *ctx)
Definition: vf_transpose_npp.c:101
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:115
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:184
NPP_TRANSPOSE_CLOCK_FLIP
@ NPP_TRANSPOSE_CLOCK_FLIP
Definition: vf_transpose_npp.c:53
npptranspose_outputs
static const AVFilterPad npptranspose_outputs[]
Definition: vf_transpose_npp.c:456
npptranspose_transpose
static int npptranspose_transpose(AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_transpose_npp.c:322
FLAGS
#define FLAGS
Definition: vf_transpose_npp.c:426
npptranspose_filter_frame
static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_transpose_npp.c:385
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
NPP_TRANSPOSE_PT_TYPE_NONE
@ NPP_TRANSPOSE_PT_TYPE_NONE
Definition: vf_transpose_npp.c:57
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:195
STAGE_TRANSPOSE
@ STAGE_TRANSPOSE
Definition: vf_transpose_npp.c:45
NPP_TRANSPOSE_CCLOCK_FLIP
@ NPP_TRANSPOSE_CCLOCK_FLIP
Definition: vf_transpose_npp.c:50
npptranspose_inputs
static const AVFilterPad npptranspose_inputs[]
Definition: vf_transpose_npp.c:448
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
STAGE_ROTATE
@ STAGE_ROTATE
Definition: vf_transpose_npp.c:44