FFmpeg
Data Structures | Macros | Functions | Variables
vf_framepack.c File Reference
#include <string.h>
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavutil/rational.h"
#include "libavutil/stereo3d.h"
#include "avfilter.h"
#include "filters.h"
#include "video.h"

Go to the source code of this file.

Data Structures

struct  FramepackContext
 

Macros

#define LEFT   0
 
#define RIGHT   1
 
#define OFFSET(x)   offsetof(FramepackContext, x)
 
#define VF   AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
 

Functions

static av_cold void framepack_uninit (AVFilterContext *ctx)
 
static int config_output (AVFilterLink *outlink)
 
static void horizontal_frame_pack (AVFilterLink *outlink, AVFrame *out, int interleaved)
 
static void vertical_frame_pack (AVFilterLink *outlink, AVFrame *out, int interleaved)
 
static av_always_inline void spatial_frame_pack (AVFilterLink *outlink, AVFrame *dst)
 
static int try_push_frame (AVFilterContext *ctx)
 
static int activate (AVFilterContext *ctx)
 
 AVFILTER_DEFINE_CLASS (framepack)
 

Variables

static enum AVPixelFormat formats_supported []
 
static const AVOption framepack_options []
 
static const AVFilterPad framepack_inputs []
 
static const AVFilterPad framepack_outputs []
 
const AVFilter ff_vf_framepack
 

Detailed Description

Generate a frame packed video, by combining two views in a single surface.

Definition in file vf_framepack.c.

Macro Definition Documentation

◆ LEFT

#define LEFT   0

Definition at line 39 of file vf_framepack.c.

◆ RIGHT

#define RIGHT   1

Definition at line 40 of file vf_framepack.c.

◆ OFFSET

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

Definition at line 418 of file vf_framepack.c.

◆ VF

Definition at line 419 of file vf_framepack.c.

Function Documentation

◆ framepack_uninit()

static av_cold void framepack_uninit ( AVFilterContext ctx)
static

Definition at line 80 of file vf_framepack.c.

◆ config_output()

static int config_output ( AVFilterLink outlink)
static

Definition at line 89 of file vf_framepack.c.

◆ horizontal_frame_pack()

static void horizontal_frame_pack ( AVFilterLink outlink,
AVFrame out,
int  interleaved 
)
static

Definition at line 158 of file vf_framepack.c.

Referenced by spatial_frame_pack().

◆ vertical_frame_pack()

static void vertical_frame_pack ( AVFilterLink outlink,
AVFrame out,
int  interleaved 
)
static

Definition at line 256 of file vf_framepack.c.

Referenced by spatial_frame_pack().

◆ spatial_frame_pack()

static av_always_inline void spatial_frame_pack ( AVFilterLink outlink,
AVFrame dst 
)
static

Definition at line 292 of file vf_framepack.c.

Referenced by try_push_frame().

◆ try_push_frame()

static int try_push_frame ( AVFilterContext ctx)
static

Definition at line 313 of file vf_framepack.c.

Referenced by activate().

◆ activate()

static int activate ( AVFilterContext ctx)
static

Definition at line 377 of file vf_framepack.c.

◆ AVFILTER_DEFINE_CLASS()

AVFILTER_DEFINE_CLASS ( framepack  )

Variable Documentation

◆ formats_supported

enum AVPixelFormat formats_supported[]
static

◆ framepack_options

const AVOption framepack_options[]
static
Initial value:
= {
{ "format", "Frame pack output format", OFFSET(format), AV_OPT_TYPE_INT,
{ .i64 = AV_STEREO3D_SIDEBYSIDE }, 0, INT_MAX, .flags = VF, .unit = "format" },
{ "sbs", "Views are packed next to each other", 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_STEREO3D_SIDEBYSIDE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
{ "tab", "Views are packed on top of each other", 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_STEREO3D_TOPBOTTOM }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
{ "frameseq", "Views are one after the other", 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_STEREO3D_FRAMESEQUENCE }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
{ "lines", "Views are interleaved by lines", 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_STEREO3D_LINES }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
{ "columns", "Views are interleaved by columns", 0, AV_OPT_TYPE_CONST,
{ .i64 = AV_STEREO3D_COLUMNS }, INT_MIN, INT_MAX, .flags = VF, .unit = "format" },
{ NULL },
}

Definition at line 420 of file vf_framepack.c.

◆ framepack_inputs

const AVFilterPad framepack_inputs[]
static
Initial value:
= {
{
.name = "left",
},
{
.name = "right",
},
}

Definition at line 438 of file vf_framepack.c.

◆ framepack_outputs

const AVFilterPad framepack_outputs[]
static
Initial value:
= {
{
.name = "packed",
.config_props = config_output,
},
}

Definition at line 449 of file vf_framepack.c.

◆ ff_vf_framepack

const AVFilter ff_vf_framepack
Initial value:
= {
.name = "framepack",
.description = NULL_IF_CONFIG_SMALL("Generate a frame packed stereoscopic video."),
.priv_size = sizeof(FramepackContext),
.priv_class = &framepack_class,
.activate = activate,
.uninit = framepack_uninit,
}

Definition at line 457 of file vf_framepack.c.

AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_YUVA422P16
Definition: pixfmt.h:546
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:525
FILTER_PIXFMTS_ARRAY
#define FILTER_PIXFMTS_ARRAY(array)
Definition: filters.h:242
framepack_outputs
static const AVFilterPad framepack_outputs[]
Definition: vf_framepack.c:449
AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUVA422P9
Definition: pixfmt.h:538
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUVA420P16
Definition: pixfmt.h:545
AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA420P10
Definition: pixfmt.h:540
AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P10
Definition: pixfmt.h:502
AV_PIX_FMT_YUV440P
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
Definition: pixfmt.h:106
AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUVA422P10
Definition: pixfmt.h:541
AV_PIX_FMT_GRAY9
#define AV_PIX_FMT_GRAY9
Definition: pixfmt.h:482
AV_STEREO3D_SIDEBYSIDE
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
Definition: stereo3d.h:64
AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA420P9
Definition: pixfmt.h:537
FramepackContext
Definition: vf_framepack.c:42
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:520
AV_PIX_FMT_GBRAP
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:212
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:518
AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA444P16
Definition: pixfmt.h:547
AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUV422P9
Definition: pixfmt.h:500
OFFSET
#define OFFSET(x)
Definition: vf_framepack.c:418
AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GRAY16
Definition: pixfmt.h:486
AV_PIX_FMT_YUV444P10
#define AV_PIX_FMT_YUV444P10
Definition: pixfmt.h:505
AV_PIX_FMT_YUVJ411P
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
Definition: pixfmt.h:283
AV_STEREO3D_FRAMESEQUENCE
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
Definition: stereo3d.h:89
AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV422P16
Definition: pixfmt.h:514
AV_PIX_FMT_YUVJ422P
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
Definition: pixfmt.h:86
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:522
AV_STEREO3D_LINES
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
Definition: stereo3d.h:126
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:523
AV_PIX_FMT_YUVA420P
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
Definition: pixfmt.h:108
AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P16
Definition: pixfmt.h:515
format
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUVA444P12
Definition: pixfmt.h:544
AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUV420P9
Definition: pixfmt.h:499
AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV420P16
Definition: pixfmt.h:513
AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_GRAY14
Definition: pixfmt.h:485
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:73
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
AV_PIX_FMT_YUVJ444P
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
Definition: pixfmt.h:87
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:483
AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_GBRP16
Definition: pixfmt.h:521
NULL
#define NULL
Definition: coverity.c:32
AV_PIX_FMT_YUVJ420P
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
Definition: pixfmt.h:85
AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_YUV440P10
Definition: pixfmt.h:504
AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_YUV422P10
Definition: pixfmt.h:503
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:81
AV_PIX_FMT_GBRP9
#define AV_PIX_FMT_GBRP9
Definition: pixfmt.h:517
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:94
AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_YUV422P12
Definition: pixfmt.h:507
AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P12
Definition: pixfmt.h:509
activate
static int activate(AVFilterContext *ctx)
Definition: vf_framepack.c:377
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA444P10
Definition: pixfmt.h:542
config_output
static int config_output(AVFilterLink *outlink)
Definition: vf_framepack.c:89
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:519
AV_STEREO3D_TOPBOTTOM
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
Definition: stereo3d.h:76
AV_PIX_FMT_YUVJ440P
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
Definition: pixfmt.h:107
framepack_uninit
static av_cold void framepack_uninit(AVFilterContext *ctx)
Definition: vf_framepack.c:80
VF
#define VF
Definition: vf_framepack.c:419
AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV444P9
Definition: pixfmt.h:501
AV_STEREO3D_COLUMNS
@ AV_STEREO3D_COLUMNS
Views are packed per column.
Definition: stereo3d.h:138
AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_YUVA444P9
Definition: pixfmt.h:539
AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUV420P12
Definition: pixfmt.h:506
AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_YUV422P14
Definition: pixfmt.h:511
AV_PIX_FMT_NONE
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:72
AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUVA422P12
Definition: pixfmt.h:543
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
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:78
AV_PIX_FMT_GBRP
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:165
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_YUV422P
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
Definition: pixfmt.h:77
framepack_inputs
static const AVFilterPad framepack_inputs[]
Definition: vf_framepack.c:438
AV_PIX_FMT_YUV411P
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
Definition: pixfmt.h:80
AV_PIX_FMT_YUV410P
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
Definition: pixfmt.h:79
AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_YUV440P12
Definition: pixfmt.h:508
AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUV444P14
Definition: pixfmt.h:512
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:484
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
AV_PIX_FMT_YUVA422P
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
Definition: pixfmt.h:173
AV_PIX_FMT_YUV420P14
#define AV_PIX_FMT_YUV420P14
Definition: pixfmt.h:510
formats_supported
static enum AVPixelFormat formats_supported[]
Definition: vf_framepack.c:53