FFmpeg
vf_transpose.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Stefano Sabatini
3  * Copyright (c) 2008 Vitor Sessak
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 /**
23  * @file
24  * transposition filter
25  * Based on MPlayer libmpcodecs/vf_rotate.c.
26  */
27 
28 #include <stdio.h>
29 
30 #include "libavutil/avassert.h"
31 #include "libavutil/imgutils.h"
32 #include "libavutil/internal.h"
33 #include "libavutil/intreadwrite.h"
34 #include "libavutil/opt.h"
35 #include "libavutil/pixdesc.h"
36 
37 #include "avfilter.h"
38 #include "filters.h"
39 #include "formats.h"
40 #include "video.h"
41 #include "transpose.h"
42 
43 typedef struct TransContext {
44  const AVClass *class;
45  int hsub, vsub;
46  int planes;
47  int pixsteps[4];
48 
49  int passthrough; ///< PassthroughType, landscape passthrough mode enabled
50  int dir; ///< TransposeDir
51 
53 } TransContext;
54 
55 static int query_formats(const AVFilterContext *ctx,
56  AVFilterFormatsConfig **cfg_in,
57  AVFilterFormatsConfig **cfg_out)
58 {
60  const AVPixFmtDescriptor *desc;
61  int fmt, ret;
62 
63  for (fmt = 0; desc = av_pix_fmt_desc_get(fmt); fmt++) {
64  if (!(desc->flags & AV_PIX_FMT_FLAG_PAL ||
65  desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
67  desc->log2_chroma_w != desc->log2_chroma_h) &&
68  (ret = ff_add_format(&pix_fmts, fmt)) < 0)
69  return ret;
70  }
71 
72 
73  return ff_set_common_formats2(ctx, cfg_in, cfg_out, pix_fmts);
74 }
75 
76 static inline void transpose_block_8_c(uint8_t *src, ptrdiff_t src_linesize,
77  uint8_t *dst, ptrdiff_t dst_linesize,
78  int w, int h)
79 {
80  int x, y;
81  for (y = 0; y < h; y++, dst += dst_linesize, src++)
82  for (x = 0; x < w; x++)
83  dst[x] = src[x*src_linesize];
84 }
85 
86 static void transpose_8x8_8_c(uint8_t *src, ptrdiff_t src_linesize,
87  uint8_t *dst, ptrdiff_t dst_linesize)
88 {
89  transpose_block_8_c(src, src_linesize, dst, dst_linesize, 8, 8);
90 }
91 
92 static inline void transpose_block_16_c(uint8_t *src, ptrdiff_t src_linesize,
93  uint8_t *dst, ptrdiff_t dst_linesize,
94  int w, int h)
95 {
96  int x, y;
97  for (y = 0; y < h; y++, dst += dst_linesize, src += 2)
98  for (x = 0; x < w; x++)
99  *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*src_linesize));
100 }
101 
102 static void transpose_8x8_16_c(uint8_t *src, ptrdiff_t src_linesize,
103  uint8_t *dst, ptrdiff_t dst_linesize)
104 {
105  transpose_block_16_c(src, src_linesize, dst, dst_linesize, 8, 8);
106 }
107 
108 static inline void transpose_block_24_c(uint8_t *src, ptrdiff_t src_linesize,
109  uint8_t *dst, ptrdiff_t dst_linesize,
110  int w, int h)
111 {
112  int x, y;
113  for (y = 0; y < h; y++, dst += dst_linesize) {
114  for (x = 0; x < w; x++) {
115  int32_t v = AV_RB24(src + x*src_linesize + y*3);
116  AV_WB24(dst + 3*x, v);
117  }
118  }
119 }
120 
121 static void transpose_8x8_24_c(uint8_t *src, ptrdiff_t src_linesize,
122  uint8_t *dst, ptrdiff_t dst_linesize)
123 {
124  transpose_block_24_c(src, src_linesize, dst, dst_linesize, 8, 8);
125 }
126 
127 static inline void transpose_block_32_c(uint8_t *src, ptrdiff_t src_linesize,
128  uint8_t *dst, ptrdiff_t dst_linesize,
129  int w, int h)
130 {
131  int x, y;
132  for (y = 0; y < h; y++, dst += dst_linesize, src += 4) {
133  for (x = 0; x < w; x++)
134  *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*src_linesize));
135  }
136 }
137 
138 static void transpose_8x8_32_c(uint8_t *src, ptrdiff_t src_linesize,
139  uint8_t *dst, ptrdiff_t dst_linesize)
140 {
141  transpose_block_32_c(src, src_linesize, dst, dst_linesize, 8, 8);
142 }
143 
144 static inline void transpose_block_48_c(uint8_t *src, ptrdiff_t src_linesize,
145  uint8_t *dst, ptrdiff_t dst_linesize,
146  int w, int h)
147 {
148  int x, y;
149  for (y = 0; y < h; y++, dst += dst_linesize, src += 6) {
150  for (x = 0; x < w; x++) {
151  int64_t v = AV_RB48(src + x*src_linesize);
152  AV_WB48(dst + 6*x, v);
153  }
154  }
155 }
156 
157 static void transpose_8x8_48_c(uint8_t *src, ptrdiff_t src_linesize,
158  uint8_t *dst, ptrdiff_t dst_linesize)
159 {
160  transpose_block_48_c(src, src_linesize, dst, dst_linesize, 8, 8);
161 }
162 
163 static inline void transpose_block_64_c(uint8_t *src, ptrdiff_t src_linesize,
164  uint8_t *dst, ptrdiff_t dst_linesize,
165  int w, int h)
166 {
167  int x, y;
168  for (y = 0; y < h; y++, dst += dst_linesize, src += 8)
169  for (x = 0; x < w; x++)
170  *((uint64_t *)(dst + 8*x)) = *((uint64_t *)(src + x*src_linesize));
171 }
172 
173 static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t src_linesize,
174  uint8_t *dst, ptrdiff_t dst_linesize)
175 {
176  transpose_block_64_c(src, src_linesize, dst, dst_linesize, 8, 8);
177 }
178 
179 static int config_props_output(AVFilterLink *outlink)
180 {
181  AVFilterContext *ctx = outlink->src;
182  TransContext *s = ctx->priv;
183  AVFilterLink *inlink = ctx->inputs[0];
184  const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format);
185  const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format);
186 
187  if (s->dir&4) {
189  "dir values greater than 3 are deprecated, use the passthrough option instead\n");
190  s->dir &= 3;
191  s->passthrough = TRANSPOSE_PT_TYPE_LANDSCAPE;
192  }
193 
194  if ((inlink->w >= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_LANDSCAPE) ||
195  (inlink->w <= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_PORTRAIT)) {
197  "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
198  inlink->w, inlink->h, inlink->w, inlink->h);
199  return 0;
200  } else {
201  s->passthrough = TRANSPOSE_PT_TYPE_NONE;
202  }
203 
204  s->hsub = desc_in->log2_chroma_w;
205  s->vsub = desc_in->log2_chroma_h;
206  s->planes = av_pix_fmt_count_planes(outlink->format);
207 
208  av_assert0(desc_in->nb_components == desc_out->nb_components);
209 
210 
211  av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out);
212 
213  outlink->w = inlink->h;
214  outlink->h = inlink->w;
215 
216  if (inlink->sample_aspect_ratio.num)
217  outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 },
218  inlink->sample_aspect_ratio);
219  else
220  outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
221 
222  for (int i = 0; i < 4; i++) {
223  TransVtable *v = &s->vtables[i];
224  switch (s->pixsteps[i]) {
226  v->transpose_8x8 = transpose_8x8_8_c; break;
228  v->transpose_8x8 = transpose_8x8_16_c; break;
230  v->transpose_8x8 = transpose_8x8_24_c; break;
232  v->transpose_8x8 = transpose_8x8_32_c; break;
234  v->transpose_8x8 = transpose_8x8_48_c; break;
236  v->transpose_8x8 = transpose_8x8_64_c; break;
237  }
238  }
239 
240 #if ARCH_X86
241  for (int i = 0; i < 4; i++) {
242  TransVtable *v = &s->vtables[i];
243 
244  ff_transpose_init_x86(v, s->pixsteps[i]);
245  }
246 #endif
247 
249  "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
250  inlink->w, inlink->h, s->dir, outlink->w, outlink->h,
251  s->dir == 1 || s->dir == 3 ? "clockwise" : "counterclockwise",
252  s->dir == 0 || s->dir == 3);
253  return 0;
254 }
255 
257 {
258  TransContext *s = inlink->dst->priv;
259 
260  return s->passthrough ?
263 }
264 
265 typedef struct ThreadData {
266  AVFrame *in, *out;
267 } ThreadData;
268 
269 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
270  int nb_jobs)
271 {
272  TransContext *s = ctx->priv;
273  ThreadData *td = arg;
274  AVFrame *out = td->out;
275  AVFrame *in = td->in;
276  int plane;
277 
278  for (plane = 0; plane < s->planes; plane++) {
279  int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
280  int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
281  int pixstep = s->pixsteps[plane];
282  int inh = AV_CEIL_RSHIFT(in->height, vsub);
283  int outw = AV_CEIL_RSHIFT(out->width, hsub);
284  int outh = AV_CEIL_RSHIFT(out->height, vsub);
285  int start = (outh * jobnr ) / nb_jobs;
286  int end = (outh * (jobnr+1)) / nb_jobs;
287  uint8_t *dst, *src;
288  int dstlinesize, srclinesize;
289  int x, y;
290  TransVtable *v = &s->vtables[plane];
291 
292  dstlinesize = out->linesize[plane];
293  dst = out->data[plane] + start * dstlinesize;
294  src = in->data[plane];
295  srclinesize = in->linesize[plane];
296 
297  if (s->dir & 1) {
298  src += in->linesize[plane] * (inh - 1);
299  srclinesize *= -1;
300  }
301 
302  if (s->dir & 2) {
303  dst = out->data[plane] + dstlinesize * (outh - start - 1);
304  dstlinesize *= -1;
305  }
306 
307  for (y = start; y < end - 7; y += 8) {
308  for (x = 0; x < outw - 7; x += 8) {
309  v->transpose_8x8(src + x * srclinesize + y * pixstep,
310  srclinesize,
311  dst + (y - start) * dstlinesize + x * pixstep,
312  dstlinesize);
313  }
314  if (outw - x > 0 && end - y > 0)
315  v->transpose_block(src + x * srclinesize + y * pixstep,
316  srclinesize,
317  dst + (y - start) * dstlinesize + x * pixstep,
318  dstlinesize, outw - x, end - y);
319  }
320 
321  if (end - y > 0)
322  v->transpose_block(src + 0 * srclinesize + y * pixstep,
323  srclinesize,
324  dst + (y - start) * dstlinesize + 0 * pixstep,
325  dstlinesize, outw, end - y);
326  }
327 
328  return 0;
329 }
330 
332 {
333  int err = 0;
334  AVFilterContext *ctx = inlink->dst;
335  TransContext *s = ctx->priv;
336  AVFilterLink *outlink = ctx->outputs[0];
337  ThreadData td;
338  AVFrame *out;
339 
340  if (s->passthrough)
341  return ff_filter_frame(outlink, in);
342 
343  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
344  if (!out) {
345  err = AVERROR(ENOMEM);
346  goto fail;
347  }
348 
349  err = av_frame_copy_props(out, in);
350  if (err < 0)
351  goto fail;
352 
353  if (in->sample_aspect_ratio.num == 0) {
354  out->sample_aspect_ratio = in->sample_aspect_ratio;
355  } else {
356  out->sample_aspect_ratio.num = in->sample_aspect_ratio.den;
357  out->sample_aspect_ratio.den = in->sample_aspect_ratio.num;
358  }
359 
360  td.in = in, td.out = out;
362  FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
363  av_frame_free(&in);
364  return ff_filter_frame(outlink, out);
365 
366 fail:
367  av_frame_free(&in);
368  av_frame_free(&out);
369  return err;
370 }
371 
372 #define OFFSET(x) offsetof(TransContext, x)
373 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
374 
375 static const AVOption transpose_options[] = {
376  { "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = TRANSPOSE_CCLOCK_FLIP }, 0, 7, FLAGS, .unit = "dir" },
377  { "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
378  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "dir" },
379  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "dir" },
380  { "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
381 
382  { "passthrough", "do not apply transposition if the input matches the specified geometry",
383  OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, .unit = "passthrough" },
384  { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, .unit = "passthrough" },
385  { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, .unit = "passthrough" },
386  { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, .unit = "passthrough" },
387 
388  { NULL }
389 };
390 
392 
394  {
395  .name = "default",
396  .type = AVMEDIA_TYPE_VIDEO,
397  .get_buffer.video = get_video_buffer,
398  .filter_frame = filter_frame,
399  },
400 };
401 
403  {
404  .name = "default",
405  .config_props = config_props_output,
406  .type = AVMEDIA_TYPE_VIDEO,
407  },
408 };
409 
411  .name = "transpose",
412  .description = NULL_IF_CONFIG_SMALL("Transpose input video."),
413  .priv_size = sizeof(TransContext),
414  .priv_class = &transpose_class,
419 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:116
transpose_8x8_24_c
static void transpose_8x8_24_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:121
transpose_8x8_16_c
static void transpose_8x8_16_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:102
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:215
TransVtable::transpose_block
void(* transpose_block)(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize, int w, int h)
Definition: transpose.h:43
AVERROR
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 they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
AV_RB48
#define AV_RB48(x)
Definition: intreadwrite.h:468
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(transpose)
out
FILE * out
Definition: movenc.c:55
avfilter_vf_transpose_outputs
static const AVFilterPad avfilter_vf_transpose_outputs[]
Definition: vf_transpose.c:402
TransContext::planes
int planes
Definition: vf_transpose.c:46
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1062
TransContext
Definition: vf_transpose.c:43
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3170
av_div_q
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition: rational.c:88
ff_set_common_formats2
int ff_set_common_formats2(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out, AVFilterFormats *formats)
Definition: formats.c:1007
int64_t
long long int64_t
Definition: coverity.c:34
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:162
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: filters.h:262
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:389
pixdesc.h
w
uint8_t w
Definition: llviddspenc.c:38
transpose_8x8_32_c
static void transpose_8x8_32_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:138
AVOption
AVOption.
Definition: opt.h:429
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)
Definition: vf_transpose.c:127
TransContext::pixsteps
int pixsteps[4]
Definition: vf_transpose.c:47
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:225
TransContext::dir
int dir
TransposeDir.
Definition: vf_transpose.c:50
TRANSPOSE_CLOCK_FLIP
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
ff_transpose_init_x86
void ff_transpose_init_x86(TransVtable *v, int pixstep)
Definition: vf_transpose_init.c:37
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:205
ThreadData::out
AVFrame * out
Definition: af_adeclick.c:526
video.h
ThreadData::in
AVFrame * in
Definition: af_adecorrelate.c:155
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)
Definition: vf_transpose.c:108
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:410
hsub
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:74
AVFilterFormats
A list of supported formats for one end of a filter link.
Definition: formats.h:64
formats.h
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)
Definition: vf_transpose.c:144
TRANSPOSE_CCLOCK
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
ff_default_get_video_buffer
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:111
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3210
fail
#define fail()
Definition: checkasm.h:188
AV_PIX_FMT_FLAG_HWACCEL
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition: pixdesc.h:128
TransContext::vsub
int vsub
Definition: vf_transpose.c:45
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: filters.h:38
transpose_8x8_48_c
static void transpose_8x8_48_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:157
avassert.h
TransVtable
Definition: transpose.h:40
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)
Definition: vf_transpose.c:92
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
AV_CEIL_RSHIFT
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:60
av_assert0
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:40
filters.h
pix_fmts
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:304
ctx
AVFormatContext * ctx
Definition: movenc.c:49
AVPixFmtDescriptor::log2_chroma_w
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: filters.h:263
arg
const char * arg
Definition: jacosubdec.c:67
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:75
query_formats
static int query_formats(const AVFilterContext *ctx, AVFilterFormatsConfig **cfg_in, AVFilterFormatsConfig **cfg_out)
Definition: vf_transpose.c:55
NULL
#define NULL
Definition: coverity.c:32
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:713
AVPixFmtDescriptor::nb_components
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
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)
Definition: vf_transpose.c:163
ff_add_format
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:504
FLAGS
#define FLAGS
Definition: vf_transpose.c:373
TransContext::vtables
TransVtable vtables[4]
Definition: vf_transpose.c:52
AVFilterFormatsConfig
Lists of formats / etc.
Definition: avfilter.h:111
transpose_options
static const AVOption transpose_options[]
Definition: vf_transpose.c:375
TRANSPOSE_PT_TYPE_PORTRAIT
@ TRANSPOSE_PT_TYPE_PORTRAIT
Definition: transpose.h:27
transpose_8x8_64_c
static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:173
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
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:83
TRANSPOSE_PT_TYPE_NONE
@ TRANSPOSE_PT_TYPE_NONE
Definition: transpose.h:25
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)
Definition: vf_transpose.c:76
AV_PIX_FMT_FLAG_BITSTREAM
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition: pixdesc.h:124
AV_WB24
#define AV_WB24(p, d)
Definition: intreadwrite.h:446
ff_null_get_video_buffer
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:44
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
internal.h
ff_filter_get_nb_threads
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:841
ThreadData
Used for passing data between threads.
Definition: dsddec.c:71
FILTER_QUERY_FUNC2
#define FILTER_QUERY_FUNC2(func)
Definition: filters.h:239
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
TRANSPOSE_CLOCK
@ TRANSPOSE_CLOCK
Definition: transpose.h:32
AVFilterPad::name
const char * name
Pad name.
Definition: filters.h:44
AV_WB48
#define AV_WB48(p, darg)
Definition: intreadwrite.h:477
filter_slice
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_transpose.c:269
TransContext::hsub
int hsub
Definition: vf_transpose.c:45
AVFilter
Filter definition.
Definition: avfilter.h:201
ret
ret
Definition: filter_design.txt:187
AVFrame::sample_aspect_ratio
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:496
get_video_buffer
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_transpose.c:256
AVFrame::height
int height
Definition: frame.h:461
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
ff_filter_execute
int ff_filter_execute(AVFilterContext *ctx, avfilter_action_func *func, void *arg, int *ret, int nb_jobs)
Definition: avfilter.c:1667
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition: opt.h:259
avfilter.h
OFFSET
#define OFFSET(x)
Definition: vf_transpose.c:372
avfilter_vf_transpose_inputs
static const AVFilterPad avfilter_vf_transpose_inputs[]
Definition: vf_transpose.c:393
transpose.h
av_image_fill_max_pixsteps
void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], const AVPixFmtDescriptor *pixdesc)
Compute the max pixel step for each plane of an image with a format described by pixdesc.
Definition: imgutils.c:35
AVFilterContext
An instance of a filter.
Definition: avfilter.h:457
TRANSPOSE_PT_TYPE_LANDSCAPE
@ TRANSPOSE_PT_TYPE_LANDSCAPE
Definition: transpose.h:26
ff_vf_transpose
const AVFilter ff_vf_transpose
Definition: vf_transpose.c:410
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:152
desc
const char * desc
Definition: libsvtav1.c:79
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
int32_t
int32_t
Definition: audioconvert.c:56
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
Definition: frame.h:434
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
config_props_output
static int config_props_output(AVFilterLink *outlink)
Definition: vf_transpose.c:179
h
h
Definition: vp9dsp_template.c:2070
transpose
#define transpose(x)
TransContext::passthrough
int passthrough
PassthroughType, landscape passthrough mode enabled.
Definition: vf_transpose.c:49
AV_RB24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
Definition: bytestream.h:97
AV_PIX_FMT_FLAG_PAL
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:120
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition: opt.h:299
TransVtable::transpose_8x8
void(* transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: transpose.h:41
transpose_8x8_8_c
static void transpose_8x8_8_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:86
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
src
#define src
Definition: vp8dsp.c:248
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_transpose.c:331