107 "Left and right sizes differ (%dx%d vs %dx%d).\n",
113 "Left and right time bases differ (%d/%d vs %d/%d).\n",
114 time_base.
num, time_base.
den,
120 "Left and right framerates differ (%d/%d vs %d/%d).\n",
121 frame_rate.
num, frame_rate.
den,
130 s->depth =
s->pix_desc->comp[0].depth;
167 if (interleaved &&
s->depth <= 8) {
168 const uint8_t *leftp =
s->input_views[
LEFT]->data[0];
169 const uint8_t *rightp =
s->input_views[
RIGHT]->data[0];
170 uint8_t *dstp =
out->data[0];
171 int length =
out->width / 2;
172 int lines =
out->height;
174 for (plane = 0; plane <
s->pix_desc->nb_components; plane++) {
175 if (plane == 1 || plane == 2) {
179 for (
i = 0;
i < lines;
i++) {
181 leftp =
s->input_views[
LEFT]->data[plane] +
182 s->input_views[
LEFT]->linesize[plane] *
i;
183 rightp =
s->input_views[
RIGHT]->data[plane] +
184 s->input_views[
RIGHT]->linesize[plane] *
i;
185 dstp =
out->data[plane] +
out->linesize[plane] *
i;
186 for (j = 0; j < length; j++) {
188 if ((
s->pix_desc->log2_chroma_w ||
189 s->pix_desc->log2_chroma_h) &&
190 (plane == 1 || plane == 2)) {
191 *dstp++ = (*leftp + *rightp) / 2;
192 *dstp++ = (*leftp + *rightp) / 2;
202 }
else if (interleaved &&
s->depth > 8) {
203 const uint16_t *leftp = (
const uint16_t *)
s->input_views[
LEFT]->data[0];
204 const uint16_t *rightp = (
const uint16_t *)
s->input_views[
RIGHT]->data[0];
205 uint16_t *dstp = (uint16_t *)
out->data[0];
206 int length =
out->width / 2;
207 int lines =
out->height;
209 for (plane = 0; plane <
s->pix_desc->nb_components; plane++) {
210 if (plane == 1 || plane == 2) {
214 for (
i = 0;
i < lines;
i++) {
216 leftp = (
const uint16_t *)
s->input_views[
LEFT]->data[plane] +
217 s->input_views[
LEFT]->linesize[plane] *
i / 2;
218 rightp = (
const uint16_t *)
s->input_views[
RIGHT]->data[plane] +
219 s->input_views[
RIGHT]->linesize[plane] *
i / 2;
220 dstp = (uint16_t *)
out->data[plane] +
out->linesize[plane] *
i / 2;
221 for (j = 0; j < length; j++) {
223 if ((
s->pix_desc->log2_chroma_w ||
224 s->pix_desc->log2_chroma_h) &&
225 (plane == 1 || plane == 2)) {
226 *dstp++ = (*leftp + *rightp) / 2;
227 *dstp++ = (*leftp + *rightp) / 2;
238 for (
i = 0;
i < 2;
i++) {
239 const AVFrame *
const input_view =
s->input_views[
i];
240 const int psize = 1 + (
s->depth > 8);
242 int sub_w = psize * input_view->
width >>
s->pix_desc->log2_chroma_w;
245 dst[1] =
out->data[1] +
i * sub_w;
246 dst[2] =
out->data[2] +
i * sub_w;
265 for (
i = 0;
i < 2;
i++) {
266 const AVFrame *
const input_view =
s->input_views[
i];
269 int sub_h = input_view->
height >>
s->pix_desc->log2_chroma_h;
271 dst[0] =
out->data[0] +
i *
out->linesize[0] *
272 (interleaved + input_view->
height * (1 - interleaved));
273 dst[1] =
out->data[1] +
i *
out->linesize[1] *
274 (interleaved + sub_h * (1 - interleaved));
275 dst[2] =
out->data[2] +
i *
out->linesize[2] *
276 (interleaved + sub_h * (1 - interleaved));
278 linesizes[0] =
out->linesize[0] +
279 interleaved *
out->linesize[0];
280 linesizes[1] =
out->linesize[1] +
281 interleaved *
out->linesize[1];
282 linesizes[2] =
out->linesize[2] +
283 interleaved *
out->linesize[2];
322 if (!(
s->input_views[0] &&
s->input_views[1]))
327 for (
i = 0;
i < 2;
i++) {
338 stereo->
type =
s->format;
363 for (
i = 0;
i < 2;
i++)
372 stereo->
type =
s->format;
386 if (!
s->input_views[0]) {
392 if (!
s->input_views[1]) {
398 if (
s->input_views[0] &&
s->input_views[1])
405 !
s->input_views[0]) {
411 !
s->input_views[1]) {
419#define OFFSET(x) offsetof(FramepackContext, x)
420#define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
459 .p.name =
"framepack",
461 .p.priv_class = &framepack_class,
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static const char *const format[]
const FFFilter ff_vf_framepack
static AVFormatContext * ctx
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Main libavfilter public API header.
#define i(width, name, range_min, range_max)
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int av_cmp_q(AVRational a, AVRational b)
Compare two rationals.
static av_always_inline AVRational av_inv_q(AVRational q)
Invert a rational.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
static void av_image_copy2(uint8_t *const dst_data[4], const int dst_linesizes[4], uint8_t *const src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Wrapper around av_image_copy() to workaround the limitation that the conversion from uint8_t * const ...
#define AV_NOPTS_VALUE
Undefined timestamp value.
AVStereo3D * av_stereo3d_create_side_data(AVFrame *frame)
Allocate a complete AVFrameSideData and add it to the frame.
@ AV_STEREO3D_COLUMNS
Views are packed per column.
@ AV_STEREO3D_LINES
Views are packed per line, as if interlaced.
@ AV_STEREO3D_TOPBOTTOM
Views are on top of each other.
@ AV_STEREO3D_FRAMESEQUENCE
Views are alternated temporally.
@ AV_STEREO3D_SIDEBYSIDE
Views are next to each other.
@ AV_STEREO3D_VIEW_RIGHT
Frame contains only the right view.
@ AV_STEREO3D_VIEW_LEFT
Frame contains only the left view.
static int activate(AVBitStreamFilterContext *ctx)
static int config_output(AVBitStreamFilterLink *outlink)
#define FILTER_INPUTS(array)
#define FILTER_OUTPUTS(array)
#define FILTER_PIXFMTS_ARRAY(array)
#define FF_FILTER_FORWARD_STATUS(inlink, outlink)
Acknowledge the status on an input link and forward it to an output link.
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
static FilterLink * ff_filter_link(AVFilterLink *link)
#define AVFILTER_DEFINE_CLASS(fname)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_YUV420P16
#define AV_PIX_FMT_YUV444P12
#define AV_PIX_FMT_YUV444P9
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV440P12
#define AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_YUV422P9
#define AV_PIX_FMT_YUVA444P10
#define AV_PIX_FMT_YUVA420P16
#define AV_PIX_FMT_YUV420P12
#define AV_PIX_FMT_YUVA420P10
#define AV_PIX_FMT_YUVA422P9
#define AV_PIX_FMT_YUV422P12
#define AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_YUV422P10
#define AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_YUV420P9
#define AV_PIX_FMT_YUVA420P9
#define AV_PIX_FMT_YUVA422P10
#define AV_PIX_FMT_YUV420P14
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_YUV420P
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
@ AV_PIX_FMT_YUV440P
planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples)
@ AV_PIX_FMT_YUV422P
planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_YUVA420P
planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples)
@ AV_PIX_FMT_YUVJ440P
planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range
@ AV_PIX_FMT_YUV410P
planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples)
@ AV_PIX_FMT_YUV411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples)
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
@ AV_PIX_FMT_YUVJ411P
planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor ...
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
@ AV_PIX_FMT_YUVJ422P
planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting col...
@ AV_PIX_FMT_YUVA422P
planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
@ AV_PIX_FMT_YUVJ444P
planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting col...
@ AV_PIX_FMT_YUVJ420P
planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting col...
#define AV_PIX_FMT_YUVA422P12
#define AV_PIX_FMT_YUV422P14
#define AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY14
#define AV_PIX_FMT_YUV422P16
#define AV_PIX_FMT_YUV440P10
#define AV_PIX_FMT_GRAY16
#define AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_YUVA444P16
#define AV_PIX_FMT_YUVA422P16
#define AV_PIX_FMT_GBRP16
#define AV_PIX_FMT_YUV444P14
#define AV_PIX_FMT_YUVA444P9
#define AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_YUVA444P12
#define AV_PIX_FMT_YUV444P16
#define AV_PIX_FMT_YUV444P10
Utilities for rational number calculation.
Describe the class of an AVClass context structure.
void * priv
private data for use by the filter
A link between two filters.
int w
agreed upon image width
int h
agreed upon image height
AVFilterContext * src
source filter
AVRational time_base
Define the time base used by the PTS of the frames/samples which will pass through this link.
int format
agreed upon media format
A filter pad used for either input or output.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
int format
format of the frame, -1 if unknown or unset Values correspond to enum AVPixelFormat for video frames,...
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Rational number (pair of numerator and denominator).
Stereo 3D type: this structure describes how two videos are packed within a single video surface,...
enum AVStereo3DType type
How views are packed within the video.
enum AVStereo3DView view
Determines which views are packed.
Link properties exposed to filter code, but not external callers.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable.
const AVPixFmtDescriptor * pix_desc
agreed pixel format
AVFrame * input_views[2]
input frames
int format
frame pack type output
static const AVFilterPad framepack_inputs[]
static const AVOption framepack_options[]
static const AVFilterPad framepack_outputs[]
static void horizontal_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
static enum AVPixelFormat formats_supported[]
static int activate(AVFilterContext *ctx)
static int config_output(AVFilterLink *outlink)
static av_always_inline void spatial_frame_pack(AVFilterLink *outlink, AVFrame *dst)
static int try_push_frame(AVFilterContext *ctx)
static av_cold void framepack_uninit(AVFilterContext *ctx)
static void vertical_frame_pack(AVFilterLink *outlink, AVFrame *out, int interleaved)
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.