114 "Left and right sizes differ (%dx%d vs %dx%d).\n",
120 "Left and right time bases differ (%d/%d vs %d/%d).\n",
121 time_base.
num, time_base.
den,
127 "Left and right framerates differ (%d/%d vs %d/%d).\n",
128 frame_rate.
num, frame_rate.
den,
130 ctx->inputs[
RIGHT]->frame_rate.den);
137 s->depth =
s->pix_desc->comp[0].depth;
174 if (interleaved &&
s->depth <= 8) {
178 int length =
out->width / 2;
179 int lines =
out->height;
181 for (plane = 0; plane <
s->pix_desc->nb_components; plane++) {
182 if (plane == 1 || plane == 2) {
186 for (
i = 0;
i < lines;
i++) {
188 leftp =
s->input_views[
LEFT]->data[plane] +
189 s->input_views[
LEFT]->linesize[plane] *
i;
190 rightp =
s->input_views[
RIGHT]->data[plane] +
191 s->input_views[
RIGHT]->linesize[plane] *
i;
192 dstp =
out->data[plane] +
out->linesize[plane] *
i;
193 for (j = 0; j < length; j++) {
195 if ((
s->pix_desc->log2_chroma_w ||
196 s->pix_desc->log2_chroma_h) &&
197 (plane == 1 || plane == 2)) {
198 *dstp++ = (*leftp + *rightp) / 2;
199 *dstp++ = (*leftp + *rightp) / 2;
209 }
else if (interleaved &&
s->depth > 8) {
210 const uint16_t *leftp = (
const uint16_t *)
s->input_views[
LEFT]->data[0];
211 const uint16_t *rightp = (
const uint16_t *)
s->input_views[
RIGHT]->data[0];
212 uint16_t *dstp = (uint16_t *)
out->data[0];
213 int length =
out->width / 2;
214 int lines =
out->height;
216 for (plane = 0; plane <
s->pix_desc->nb_components; plane++) {
217 if (plane == 1 || plane == 2) {
221 for (
i = 0;
i < lines;
i++) {
223 leftp = (
const uint16_t *)
s->input_views[
LEFT]->data[plane] +
224 s->input_views[
LEFT]->linesize[plane] *
i / 2;
225 rightp = (
const uint16_t *)
s->input_views[
RIGHT]->data[plane] +
226 s->input_views[
RIGHT]->linesize[plane] *
i / 2;
227 dstp = (uint16_t *)
out->data[plane] +
out->linesize[plane] *
i / 2;
228 for (j = 0; j < length; j++) {
230 if ((
s->pix_desc->log2_chroma_w ||
231 s->pix_desc->log2_chroma_h) &&
232 (plane == 1 || plane == 2)) {
233 *dstp++ = (*leftp + *rightp) / 2;
234 *dstp++ = (*leftp + *rightp) / 2;
245 for (
i = 0;
i < 2;
i++) {
246 const int psize = 1 + (
s->depth > 8);
249 int sub_w = psize *
s->input_views[
i]->width >>
s->pix_desc->log2_chroma_w;
251 src[0] =
s->input_views[
i]->data[0];
252 src[1] =
s->input_views[
i]->data[1];
253 src[2] =
s->input_views[
i]->data[2];
255 dst[0] =
out->data[0] +
i *
s->input_views[
i]->width * psize;
256 dst[1] =
out->data[1] +
i * sub_w;
257 dst[2] =
out->data[2] +
i * sub_w;
260 s->input_views[
i]->format,
261 s->input_views[
i]->width,
262 s->input_views[
i]->height);
275 for (
i = 0;
i < 2;
i++) {
279 int sub_h =
s->input_views[
i]->height >>
s->pix_desc->log2_chroma_h;
281 src[0] =
s->input_views[
i]->data[0];
282 src[1] =
s->input_views[
i]->data[1];
283 src[2] =
s->input_views[
i]->data[2];
285 dst[0] =
out->data[0] +
i *
out->linesize[0] *
286 (interleaved +
s->input_views[
i]->height * (1 - interleaved));
287 dst[1] =
out->data[1] +
i *
out->linesize[1] *
288 (interleaved + sub_h * (1 - interleaved));
289 dst[2] =
out->data[2] +
i *
out->linesize[2] *
290 (interleaved + sub_h * (1 - interleaved));
292 linesizes[0] =
out->linesize[0] +
293 interleaved *
out->linesize[0];
294 linesizes[1] =
out->linesize[1] +
295 interleaved *
out->linesize[1];
296 linesizes[2] =
out->linesize[2] +
297 interleaved *
out->linesize[2];
300 s->input_views[
i]->format,
301 s->input_views[
i]->width,
302 s->input_views[
i]->height);
334 if (!(
s->input_views[0] &&
s->input_views[1]))
339 for (
i = 0;
i < 2;
i++) {
348 stereo->
type =
s->format;
373 for (
i = 0;
i < 2;
i++)
382 stereo->
type =
s->format;
396 if (!
s->input_views[0]) {
402 if (!
s->input_views[1]) {
408 if (
s->input_views[0] &&
s->input_views[1])
416 !
s->input_views[0]) {
423 !
s->input_views[1]) {
431 #define OFFSET(x) offsetof(FramepackContext, x)
432 #define VF AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_FILTERING_PARAM
476 .priv_class = &framepack_class,
static const AVFilterPad inputs[]
static const AVFilterPad outputs[]
static const char *const format[]
int ff_outlink_get_status(AVFilterLink *link)
Get the status on an output link.
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
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.
common internal and external API header
#define AV_CEIL_RSHIFT(a, b)
static av_cold int uninit(AVCodecContext *avctx)
#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.
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
static int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
#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.
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum AVPixelFormat pix_fmt, int width, int height)
Copy image in src_data to dst_data.
#define AV_NOPTS_VALUE
Undefined timestamp value.
AVStereo3DType
List of possible 3D Types.
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.
common internal API header
#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
Utilties 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.
AVRational frame_rate
Frame rate of the stream on the link, or 1/0 if unknown or variable; if left to 0/0,...
int format
agreed upon media format
A filter pad used for either input or output.
const char * name
Pad name.
const char * name
Filter name.
This structure describes decoded (raw) audio or video data.
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.
const AVPixFmtDescriptor * pix_desc
agreed pixel format
AVFrame * input_views[2]
input frames
enum AVStereo3DType format
frame pack type output
static const AVFilterPad framepack_inputs[]
static int query_formats(AVFilterContext *ctx)
AVFILTER_DEFINE_CLASS(framepack)
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.