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 npptranspose_query_formats (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 []
 
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 435 of file vf_transpose_npp.c.

◆ FLAGS

Definition at line 436 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.

◆ npptranspose_query_formats()

static int npptranspose_query_formats ( AVFilterContext ctx)
static

Definition at line 114 of file vf_transpose_npp.c.

◆ init_stage()

static int init_stage ( NPPTransposeStageContext stage,
AVBufferRef device_ctx 
)
static

Definition at line 124 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 177 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 188 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 260 of file vf_transpose_npp.c.

◆ npptranspose_rotate()

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

Definition at line 298 of file vf_transpose_npp.c.

◆ npptranspose_transpose()

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

Definition at line 332 of file vf_transpose_npp.c.

◆ npptranspose_filter()

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

Definition at line 360 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 395 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 354 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 438 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 451 of file vf_transpose_npp.c.

◆ npptranspose_inputs

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

Definition at line 458 of file vf_transpose_npp.c.

◆ npptranspose_outputs

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

Definition at line 467 of file vf_transpose_npp.c.

◆ ff_vf_transpose_npp

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

Definition at line 476 of file vf_transpose_npp.c.

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:385
npptranspose_class
static const AVClass npptranspose_class
Definition: vf_transpose_npp.c:451
options
static const AVOption options[]
Definition: vf_transpose_npp.c:438
npptranspose_config_props
static int npptranspose_config_props(AVFilterLink *outlink)
Definition: vf_transpose_npp.c:260
npptranspose_query_formats
static int npptranspose_query_formats(AVFilterContext *ctx)
Definition: vf_transpose_npp.c:114
OFFSET
#define OFFSET(x)
Definition: vf_transpose_npp.c:435
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:298
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
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
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:191
inputs
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several inputs
Definition: filter_design.txt:243
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:188
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:467
npptranspose_transpose
static int npptranspose_transpose(AVFilterContext *ctx, NPPTransposeStageContext *stage, AVFrame *out, AVFrame *in)
Definition: vf_transpose_npp.c:332
FLAGS
#define FLAGS
Definition: vf_transpose_npp.c:436
npptranspose_filter_frame
static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_transpose_npp.c:395
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:223
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
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:458
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:232
STAGE_ROTATE
@ STAGE_ROTATE
Definition: vf_transpose_npp.c:44