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

#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.

Referenced by npptranspose_filter_frame().

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

Definition at line 435 of file vf_transpose_npp.c.

Definition at line 436 of file vf_transpose_npp.c.

Enumeration Type Documentation

Enumerator
STAGE_ROTATE 
STAGE_TRANSPOSE 
STAGE_NB 

Definition at line 43 of file vf_transpose_npp.c.

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.

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

static int npptranspose_init ( AVFilterContext ctx)
static

Definition at line 83 of file vf_transpose_npp.c.

static void npptranspose_uninit ( AVFilterContext ctx)
static

Definition at line 101 of file vf_transpose_npp.c.

static int npptranspose_query_formats ( AVFilterContext ctx)
static

Definition at line 114 of file vf_transpose_npp.c.

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().

static int format_is_supported ( enum AVPixelFormat  fmt)
static

Definition at line 177 of file vf_transpose_npp.c.

Referenced by 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().

static int npptranspose_config_props ( AVFilterLink outlink)
static

Definition at line 260 of file vf_transpose_npp.c.

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

Definition at line 298 of file vf_transpose_npp.c.

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

Definition at line 332 of file vf_transpose_npp.c.

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().

static int npptranspose_filter_frame ( AVFilterLink link,
AVFrame in 
)
static

Definition at line 395 of file vf_transpose_npp.c.

Variable Documentation

enum AVPixelFormat supported_formats[]
static
Initial value:
= {
}
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Definition: pixfmt.h:66

Definition at line 38 of file vf_transpose_npp.c.

Referenced by format_is_supported().

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

Definition at line 354 of file vf_transpose_npp.c.

Referenced by npptranspose_filter().

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 },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
#define FLAGS

Definition at line 438 of file vf_transpose_npp.c.

const AVClass npptranspose_class
static
Initial value:
= {
.class_name = "npptranspose",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191
static const AVOption options[]

Definition at line 451 of file vf_transpose_npp.c.

const AVFilterPad npptranspose_inputs[]
static
Initial value:
= {
{
.name = "default",
.filter_frame = npptranspose_filter_frame,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int npptranspose_filter_frame(AVFilterLink *link, AVFrame *in)

Definition at line 458 of file vf_transpose_npp.c.

const AVFilterPad npptranspose_outputs[]
static
Initial value:
= {
{
.name = "default",
.config_props = npptranspose_config_props,
},
{ NULL }
}
#define NULL
Definition: coverity.c:32
static int npptranspose_config_props(AVFilterLink *outlink)

Definition at line 467 of file vf_transpose_npp.c.

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,
}
#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
static const AVFilterPad npptranspose_inputs[]
static int npptranspose_init(AVFilterContext *ctx)
static void npptranspose_uninit(AVFilterContext *ctx)
static const AVClass npptranspose_class
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
static int npptranspose_query_formats(AVFilterContext *ctx)
static const AVFilterPad npptranspose_outputs[]
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
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 at line 476 of file vf_transpose_npp.c.