FFmpeg
Data Structures | Macros | Functions | Variables
vf_transpose.c File Reference
#include <stdio.h>
#include "libavutil/avassert.h"
#include "libavutil/imgutils.h"
#include "libavutil/internal.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "formats.h"
#include "internal.h"
#include "video.h"
#include "transpose.h"

Go to the source code of this file.

Data Structures

struct  TransContext
 
struct  ThreadData
 Used for passing data between threads. More...
 

Macros

#define OFFSET(x)   offsetof(TransContext, x)
 
#define FLAGS   AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
 

Functions

static int query_formats (AVFilterContext *ctx)
 
static void transpose_block_8_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_8_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static void transpose_block_16_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_16_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static void transpose_block_24_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_24_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static void transpose_block_32_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_32_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static void transpose_block_48_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_48_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static void transpose_block_64_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
 
static void transpose_8x8_64_c (uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
 
static int config_props_output (AVFilterLink *outlink)
 
static AVFrameget_video_buffer (AVFilterLink *inlink, int w, int h)
 
static int filter_slice (AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
 
static int filter_frame (AVFilterLink *inlink, AVFrame *in)
 
 AVFILTER_DEFINE_CLASS (transpose)
 

Variables

static const AVOption transpose_options []
 
static const AVFilterPad avfilter_vf_transpose_inputs []
 
static const AVFilterPad avfilter_vf_transpose_outputs []
 
const AVFilter ff_vf_transpose
 

Detailed Description

transposition filter Based on MPlayer libmpcodecs/vf_rotate.c.

Definition in file vf_transpose.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 360 of file vf_transpose.c.

◆ FLAGS

Definition at line 361 of file vf_transpose.c.

Function Documentation

◆ query_formats()

static int query_formats ( AVFilterContext ctx)
static

Definition at line 55 of file vf_transpose.c.

◆ transpose_block_8_c()

static void transpose_block_8_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 74 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_8_c().

◆ transpose_8x8_8_c()

static void transpose_8x8_8_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 84 of file vf_transpose.c.

Referenced by config_props_output().

◆ transpose_block_16_c()

static void transpose_block_16_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 90 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_16_c().

◆ transpose_8x8_16_c()

static void transpose_8x8_16_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 100 of file vf_transpose.c.

Referenced by config_props_output().

◆ transpose_block_24_c()

static void transpose_block_24_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 106 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_24_c().

◆ transpose_8x8_24_c()

static void transpose_8x8_24_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 119 of file vf_transpose.c.

Referenced by config_props_output().

◆ transpose_block_32_c()

static void transpose_block_32_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 125 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_32_c().

◆ transpose_8x8_32_c()

static void transpose_8x8_32_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 136 of file vf_transpose.c.

Referenced by config_props_output().

◆ transpose_block_48_c()

static void transpose_block_48_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 142 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_48_c().

◆ transpose_8x8_48_c()

static void transpose_8x8_48_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 155 of file vf_transpose.c.

Referenced by config_props_output().

◆ transpose_block_64_c()

static void transpose_block_64_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize,
int  w,
int  h 
)
inlinestatic

Definition at line 161 of file vf_transpose.c.

Referenced by config_props_output(), and transpose_8x8_64_c().

◆ transpose_8x8_64_c()

static void transpose_8x8_64_c ( uint8_t *  src,
ptrdiff_t  src_linesize,
uint8_t *  dst,
ptrdiff_t  dst_linesize 
)
static

Definition at line 171 of file vf_transpose.c.

Referenced by config_props_output().

◆ config_props_output()

static int config_props_output ( AVFilterLink outlink)
static

Definition at line 177 of file vf_transpose.c.

◆ get_video_buffer()

static AVFrame* get_video_buffer ( AVFilterLink inlink,
int  w,
int  h 
)
static

Definition at line 254 of file vf_transpose.c.

◆ filter_slice()

static int filter_slice ( AVFilterContext ctx,
void *  arg,
int  jobnr,
int  nb_jobs 
)
static

Definition at line 267 of file vf_transpose.c.

Referenced by filter_frame().

◆ filter_frame()

static int filter_frame ( AVFilterLink inlink,
AVFrame in 
)
static

Definition at line 329 of file vf_transpose.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( transpose  )

Variable Documentation

◆ transpose_options

const AVOption transpose_options[]
static
Initial value:
= {
{ "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = TRANSPOSE_CCLOCK_FLIP }, 0, 7, FLAGS, "dir" },
{ "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
{ "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "dir" },
{ "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "dir" },
{ "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
{ "passthrough", "do not apply transposition if the input matches the specified geometry",
OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" },
{ "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
{ "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
{ "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
{ NULL }
}

Definition at line 363 of file vf_transpose.c.

◆ avfilter_vf_transpose_inputs

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

Definition at line 381 of file vf_transpose.c.

◆ avfilter_vf_transpose_outputs

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

Definition at line 391 of file vf_transpose.c.

◆ ff_vf_transpose

const AVFilter ff_vf_transpose
Initial value:
= {
.name = "transpose",
.description = NULL_IF_CONFIG_SMALL("Transpose input video."),
.priv_size = sizeof(TransContext),
.priv_class = &transpose_class,
}

Definition at line 400 of file vf_transpose.c.

avfilter_vf_transpose_outputs
static const AVFilterPad avfilter_vf_transpose_outputs[]
Definition: vf_transpose.c:391
TransContext
Definition: vf_transpose.c:43
TRANSPOSE_CLOCK_FLIP
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
TRANSPOSE_CCLOCK
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
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
query_formats
static int query_formats(AVFilterContext *ctx)
Definition: vf_transpose.c:55
outputs
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
NULL
#define NULL
Definition: coverity.c:32
FLAGS
#define FLAGS
Definition: vf_transpose.c:361
TRANSPOSE_PT_TYPE_PORTRAIT
@ TRANSPOSE_PT_TYPE_PORTRAIT
Definition: transpose.h:27
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:117
TRANSPOSE_PT_TYPE_NONE
@ TRANSPOSE_PT_TYPE_NONE
Definition: transpose.h:25
TRANSPOSE_CLOCK
@ TRANSPOSE_CLOCK
Definition: transpose.h:32
get_video_buffer
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_transpose.c:254
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:225
OFFSET
#define OFFSET(x)
Definition: vf_transpose.c:360
avfilter_vf_transpose_inputs
static const AVFilterPad avfilter_vf_transpose_inputs[]
Definition: vf_transpose.c:381
TRANSPOSE_PT_TYPE_LANDSCAPE
@ TRANSPOSE_PT_TYPE_LANDSCAPE
Definition: transpose.h:26
AVFILTER_FLAG_SLICE_THREADS
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
config_props_output
static int config_props_output(AVFilterLink *outlink)
Definition: vf_transpose.c:177
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_transpose.c:329