FFmpeg  4.4.8
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 "internal.h"
41 #include "video.h"
42 #include "transpose.h"
43 
44 typedef struct TransContext {
45  const AVClass *class;
46  int hsub, vsub;
47  int planes;
48  int pixsteps[4];
49 
50  int passthrough; ///< PassthroughType, landscape passthrough mode enabled
51  int dir; ///< TransposeDir
52 
54 } TransContext;
55 
57 {
59  int fmt, ret;
60 
61  for (fmt = 0; av_pix_fmt_desc_get(fmt); fmt++) {
63  if (!(desc->flags & AV_PIX_FMT_FLAG_PAL ||
64  desc->flags & AV_PIX_FMT_FLAG_HWACCEL ||
66  desc->log2_chroma_w != desc->log2_chroma_h) &&
67  (ret = ff_add_format(&pix_fmts, fmt)) < 0)
68  return ret;
69  }
70 
71 
73 }
74 
75 static inline void transpose_block_8_c(uint8_t *src, ptrdiff_t src_linesize,
76  uint8_t *dst, ptrdiff_t dst_linesize,
77  int w, int h)
78 {
79  int x, y;
80  for (y = 0; y < h; y++, dst += dst_linesize, src++)
81  for (x = 0; x < w; x++)
82  dst[x] = src[x*src_linesize];
83 }
84 
85 static void transpose_8x8_8_c(uint8_t *src, ptrdiff_t src_linesize,
86  uint8_t *dst, ptrdiff_t dst_linesize)
87 {
88  transpose_block_8_c(src, src_linesize, dst, dst_linesize, 8, 8);
89 }
90 
91 static inline void transpose_block_16_c(uint8_t *src, ptrdiff_t src_linesize,
92  uint8_t *dst, ptrdiff_t dst_linesize,
93  int w, int h)
94 {
95  int x, y;
96  for (y = 0; y < h; y++, dst += dst_linesize, src += 2)
97  for (x = 0; x < w; x++)
98  *((uint16_t *)(dst + 2*x)) = *((uint16_t *)(src + x*src_linesize));
99 }
100 
101 static void transpose_8x8_16_c(uint8_t *src, ptrdiff_t src_linesize,
102  uint8_t *dst, ptrdiff_t dst_linesize)
103 {
104  transpose_block_16_c(src, src_linesize, dst, dst_linesize, 8, 8);
105 }
106 
107 static inline void transpose_block_24_c(uint8_t *src, ptrdiff_t src_linesize,
108  uint8_t *dst, ptrdiff_t dst_linesize,
109  int w, int h)
110 {
111  int x, y;
112  for (y = 0; y < h; y++, dst += dst_linesize) {
113  for (x = 0; x < w; x++) {
114  int32_t v = AV_RB24(src + x*src_linesize + y*3);
115  AV_WB24(dst + 3*x, v);
116  }
117  }
118 }
119 
120 static void transpose_8x8_24_c(uint8_t *src, ptrdiff_t src_linesize,
121  uint8_t *dst, ptrdiff_t dst_linesize)
122 {
123  transpose_block_24_c(src, src_linesize, dst, dst_linesize, 8, 8);
124 }
125 
126 static inline void transpose_block_32_c(uint8_t *src, ptrdiff_t src_linesize,
127  uint8_t *dst, ptrdiff_t dst_linesize,
128  int w, int h)
129 {
130  int x, y;
131  for (y = 0; y < h; y++, dst += dst_linesize, src += 4) {
132  for (x = 0; x < w; x++)
133  *((uint32_t *)(dst + 4*x)) = *((uint32_t *)(src + x*src_linesize));
134  }
135 }
136 
137 static void transpose_8x8_32_c(uint8_t *src, ptrdiff_t src_linesize,
138  uint8_t *dst, ptrdiff_t dst_linesize)
139 {
140  transpose_block_32_c(src, src_linesize, dst, dst_linesize, 8, 8);
141 }
142 
143 static inline void transpose_block_48_c(uint8_t *src, ptrdiff_t src_linesize,
144  uint8_t *dst, ptrdiff_t dst_linesize,
145  int w, int h)
146 {
147  int x, y;
148  for (y = 0; y < h; y++, dst += dst_linesize, src += 6) {
149  for (x = 0; x < w; x++) {
150  int64_t v = AV_RB48(src + x*src_linesize);
151  AV_WB48(dst + 6*x, v);
152  }
153  }
154 }
155 
156 static void transpose_8x8_48_c(uint8_t *src, ptrdiff_t src_linesize,
157  uint8_t *dst, ptrdiff_t dst_linesize)
158 {
159  transpose_block_48_c(src, src_linesize, dst, dst_linesize, 8, 8);
160 }
161 
162 static inline void transpose_block_64_c(uint8_t *src, ptrdiff_t src_linesize,
163  uint8_t *dst, ptrdiff_t dst_linesize,
164  int w, int h)
165 {
166  int x, y;
167  for (y = 0; y < h; y++, dst += dst_linesize, src += 8)
168  for (x = 0; x < w; x++)
169  *((uint64_t *)(dst + 8*x)) = *((uint64_t *)(src + x*src_linesize));
170 }
171 
172 static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t src_linesize,
173  uint8_t *dst, ptrdiff_t dst_linesize)
174 {
175  transpose_block_64_c(src, src_linesize, dst, dst_linesize, 8, 8);
176 }
177 
178 static int config_props_output(AVFilterLink *outlink)
179 {
180  AVFilterContext *ctx = outlink->src;
181  TransContext *s = ctx->priv;
182  AVFilterLink *inlink = ctx->inputs[0];
183  const AVPixFmtDescriptor *desc_out = av_pix_fmt_desc_get(outlink->format);
184  const AVPixFmtDescriptor *desc_in = av_pix_fmt_desc_get(inlink->format);
185 
186  if (s->dir&4) {
188  "dir values greater than 3 are deprecated, use the passthrough option instead\n");
189  s->dir &= 3;
190  s->passthrough = TRANSPOSE_PT_TYPE_LANDSCAPE;
191  }
192 
193  if ((inlink->w >= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_LANDSCAPE) ||
194  (inlink->w <= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_PORTRAIT)) {
196  "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
197  inlink->w, inlink->h, inlink->w, inlink->h);
198  return 0;
199  } else {
200  s->passthrough = TRANSPOSE_PT_TYPE_NONE;
201  }
202 
203  s->hsub = desc_in->log2_chroma_w;
204  s->vsub = desc_in->log2_chroma_h;
205  s->planes = av_pix_fmt_count_planes(outlink->format);
206 
207  av_assert0(desc_in->nb_components == desc_out->nb_components);
208 
209 
210  av_image_fill_max_pixsteps(s->pixsteps, NULL, desc_out);
211 
212  outlink->w = inlink->h;
213  outlink->h = inlink->w;
214 
215  if (inlink->sample_aspect_ratio.num)
216  outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 },
217  inlink->sample_aspect_ratio);
218  else
219  outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
220 
221  for (int i = 0; i < 4; i++) {
222  TransVtable *v = &s->vtables[i];
223  switch (s->pixsteps[i]) {
225  v->transpose_8x8 = transpose_8x8_8_c; break;
227  v->transpose_8x8 = transpose_8x8_16_c; break;
229  v->transpose_8x8 = transpose_8x8_24_c; break;
231  v->transpose_8x8 = transpose_8x8_32_c; break;
233  v->transpose_8x8 = transpose_8x8_48_c; break;
235  v->transpose_8x8 = transpose_8x8_64_c; break;
236  }
237  }
238 
239  if (ARCH_X86) {
240  for (int i = 0; i < 4; i++) {
241  TransVtable *v = &s->vtables[i];
242 
243  ff_transpose_init_x86(v, s->pixsteps[i]);
244  }
245  }
246 
248  "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
249  inlink->w, inlink->h, s->dir, outlink->w, outlink->h,
250  s->dir == 1 || s->dir == 3 ? "clockwise" : "counterclockwise",
251  s->dir == 0 || s->dir == 3);
252  return 0;
253 }
254 
255 static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
256 {
257  TransContext *s = inlink->dst->priv;
258 
259  return s->passthrough ?
260  ff_null_get_video_buffer (inlink, w, h) :
261  ff_default_get_video_buffer(inlink, w, h);
262 }
263 
264 typedef struct ThreadData {
265  AVFrame *in, *out;
266 } ThreadData;
267 
268 static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr,
269  int nb_jobs)
270 {
271  TransContext *s = ctx->priv;
272  ThreadData *td = arg;
273  AVFrame *out = td->out;
274  AVFrame *in = td->in;
275  int plane;
276 
277  for (plane = 0; plane < s->planes; plane++) {
278  int hsub = plane == 1 || plane == 2 ? s->hsub : 0;
279  int vsub = plane == 1 || plane == 2 ? s->vsub : 0;
280  int pixstep = s->pixsteps[plane];
281  int inh = AV_CEIL_RSHIFT(in->height, vsub);
282  int outw = AV_CEIL_RSHIFT(out->width, hsub);
283  int outh = AV_CEIL_RSHIFT(out->height, vsub);
284  int start = ff_slice_pos(outh, jobnr, nb_jobs);
285  int end = ff_slice_pos(outh, jobnr + 1, nb_jobs);
286  uint8_t *dst, *src;
287  int dstlinesize, srclinesize;
288  int x, y;
289  TransVtable *v = &s->vtables[plane];
290 
291  dstlinesize = out->linesize[plane];
292  dst = out->data[plane] + start * dstlinesize;
293  src = in->data[plane];
294  srclinesize = in->linesize[plane];
295 
296  if (s->dir & 1) {
297  src += in->linesize[plane] * (inh - 1);
298  srclinesize *= -1;
299  }
300 
301  if (s->dir & 2) {
302  dst = out->data[plane] + dstlinesize * (outh - start - 1);
303  dstlinesize *= -1;
304  }
305 
306  for (y = start; y < end - 7; y += 8) {
307  for (x = 0; x < outw - 7; x += 8) {
308  v->transpose_8x8(src + x * srclinesize + y * pixstep,
309  srclinesize,
310  dst + (y - start) * dstlinesize + x * pixstep,
311  dstlinesize);
312  }
313  if (outw - x > 0 && end - y > 0)
314  v->transpose_block(src + x * srclinesize + y * pixstep,
315  srclinesize,
316  dst + (y - start) * dstlinesize + x * pixstep,
317  dstlinesize, outw - x, end - y);
318  }
319 
320  if (end - y > 0)
321  v->transpose_block(src + 0 * srclinesize + y * pixstep,
322  srclinesize,
323  dst + (y - start) * dstlinesize + 0 * pixstep,
324  dstlinesize, outw, end - y);
325  }
326 
327  return 0;
328 }
329 
330 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
331 {
332  AVFilterContext *ctx = inlink->dst;
333  TransContext *s = ctx->priv;
334  AVFilterLink *outlink = ctx->outputs[0];
335  ThreadData td;
336  AVFrame *out;
337 
338  if (s->passthrough)
339  return ff_filter_frame(outlink, in);
340 
341  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
342  if (!out) {
343  av_frame_free(&in);
344  return AVERROR(ENOMEM);
345  }
347 
348  if (in->sample_aspect_ratio.num == 0) {
349  out->sample_aspect_ratio = in->sample_aspect_ratio;
350  } else {
351  out->sample_aspect_ratio.num = in->sample_aspect_ratio.den;
352  out->sample_aspect_ratio.den = in->sample_aspect_ratio.num;
353  }
354 
355  td.in = in, td.out = out;
356  ctx->internal->execute(ctx, filter_slice, &td, NULL, FFMIN(outlink->h, ff_filter_get_nb_threads(ctx)));
357  av_frame_free(&in);
358  return ff_filter_frame(outlink, out);
359 }
360 
361 #define OFFSET(x) offsetof(TransContext, x)
362 #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
363 
364 static const AVOption transpose_options[] = {
365  { "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = TRANSPOSE_CCLOCK_FLIP }, 0, 7, FLAGS, "dir" },
366  { "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
367  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "dir" },
368  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "dir" },
369  { "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
370 
371  { "passthrough", "do not apply transposition if the input matches the specified geometry",
372  OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" },
373  { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
374  { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
375  { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
376 
377  { NULL }
378 };
379 
381 
383  {
384  .name = "default",
385  .type = AVMEDIA_TYPE_VIDEO,
386  .get_video_buffer = get_video_buffer,
387  .filter_frame = filter_frame,
388  },
389  { NULL }
390 };
391 
393  {
394  .name = "default",
395  .config_props = config_props_output,
396  .type = AVMEDIA_TYPE_VIDEO,
397  },
398  { NULL }
399 };
400 
402  .name = "transpose",
403  .description = NULL_IF_CONFIG_SMALL("Transpose input video."),
404  .priv_size = sizeof(TransContext),
405  .priv_class = &transpose_class,
410 };
static const AVFilterPad inputs[]
Definition: af_acontrast.c:193
static const AVFilterPad outputs[]
Definition: af_acontrast.c:203
uint8_t pi<< 24) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0f/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_U8, uint8_t,(*(const uint8_t *) pi - 0x80) *(1.0/(1<< 7))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S16, int16_t,(*(const int16_t *) pi >> 8)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0f/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S16, int16_t, *(const int16_t *) pi *(1.0/(1<< 15))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_S32, int32_t,(*(const int32_t *) pi >> 24)+0x80) CONV_FUNC_GROUP(AV_SAMPLE_FMT_FLT, float, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0f/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_DBL, double, AV_SAMPLE_FMT_S32, int32_t, *(const int32_t *) pi *(1.0/(1U<< 31))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_FLT, float, av_clip_uint8(lrintf(*(const float *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_FLT, float, av_clip_int16(lrintf(*(const float *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_FLT, float, av_clipl_int32(llrintf(*(const float *) pi *(1U<< 31)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_U8, uint8_t, AV_SAMPLE_FMT_DBL, double, av_clip_uint8(lrint(*(const double *) pi *(1<< 7))+0x80)) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S16, int16_t, AV_SAMPLE_FMT_DBL, double, av_clip_int16(lrint(*(const double *) pi *(1<< 15)))) CONV_FUNC_GROUP(AV_SAMPLE_FMT_S32, int32_t, AV_SAMPLE_FMT_DBL, double, av_clipl_int32(llrint(*(const double *) pi *(1U<< 31)))) #define SET_CONV_FUNC_GROUP(ofmt, ifmt) static void set_generic_function(AudioConvert *ac) { } void ff_audio_convert_free(AudioConvert **ac) { if(! *ac) return;ff_dither_free(&(*ac) ->dc);av_freep(ac);} AudioConvert *ff_audio_convert_alloc(AVAudioResampleContext *avr, enum AVSampleFormat out_fmt, enum AVSampleFormat in_fmt, int channels, int sample_rate, int apply_map) { AudioConvert *ac;int in_planar, out_planar;ac=av_mallocz(sizeof(*ac));if(!ac) return NULL;ac->avr=avr;ac->out_fmt=out_fmt;ac->in_fmt=in_fmt;ac->channels=channels;ac->apply_map=apply_map;if(avr->dither_method !=AV_RESAMPLE_DITHER_NONE &&av_get_packed_sample_fmt(out_fmt)==AV_SAMPLE_FMT_S16 &&av_get_bytes_per_sample(in_fmt) > 2) { ac->dc=ff_dither_alloc(avr, out_fmt, in_fmt, channels, sample_rate, apply_map);if(!ac->dc) { av_free(ac);return NULL;} return ac;} in_planar=ff_sample_fmt_is_planar(in_fmt, channels);out_planar=ff_sample_fmt_is_planar(out_fmt, channels);if(in_planar==out_planar) { ac->func_type=CONV_FUNC_TYPE_FLAT;ac->planes=in_planar ? ac->channels :1;} else if(in_planar) ac->func_type=CONV_FUNC_TYPE_INTERLEAVE;else ac->func_type=CONV_FUNC_TYPE_DEINTERLEAVE;set_generic_function(ac);if(ARCH_AARCH64) ff_audio_convert_init_aarch64(ac);if(ARCH_ARM) ff_audio_convert_init_arm(ac);if(ARCH_X86) ff_audio_convert_init_x86(ac);return ac;} int ff_audio_convert(AudioConvert *ac, AudioData *out, AudioData *in) { int use_generic=1;int len=in->nb_samples;int p;if(ac->dc) { av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (dithered)\n", len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt));return ff_convert_dither(ac-> in
uint8_t
int32_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Definition: avassert.h:37
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1096
int ff_filter_get_nb_threads(AVFilterContext *ctx)
Get number of threads for current filter instance.
Definition: avfilter.c:802
Main libavfilter public API header.
#define AV_RB24
Definition: intreadwrite.h:64
#define flags(name, subs,...)
Definition: cbs_av1.c:572
#define s(width, name)
Definition: cbs_vp9.c:257
#define FFMIN(a, b)
Definition: common.h:105
#define AV_CEIL_RSHIFT(a, b)
Definition: common.h:58
#define ARCH_X86
Definition: config.h:39
#define NULL
Definition: coverity.c:32
long long int64_t
Definition: coverity.c:34
static int ff_slice_pos(int total, int jobnr, int nb_jobs)
Compute the boundary index for a slice when work of size total is split into nb_jobs slices.
Definition: filters.h:271
int ff_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
A helper for query_formats() which sets all links to the same list of formats.
Definition: formats.c:587
int ff_add_format(AVFilterFormats **avff, int64_t fmt)
Add fmt to the list of media formats contained in *avff.
Definition: formats.c:332
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
@ AV_OPT_TYPE_INT
Definition: opt.h:225
#define AVFILTER_FLAG_SLICE_THREADS
The filter supports multithreading by splitting frames into multiple parts and processing them concur...
Definition: avfilter.h:117
#define AVERROR(e)
Definition: error.h:43
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:203
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:658
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:200
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:210
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition: rational.c:88
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
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
misc image utilities
int i
Definition: input.c:407
#define AV_WB24(p, d)
Definition: intreadwrite.h:450
#define AV_WB48(p, darg)
Definition: intreadwrite.h:481
#define AV_RB48(x)
Definition: intreadwrite.h:472
const char * arg
Definition: jacosubdec.c:66
#define transpose(x)
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
static enum AVPixelFormat pix_fmts[]
Definition: libkvazaar.c:309
const char * desc
Definition: libsvtav1.c:79
uint8_t w
Definition: llviddspenc.c:39
AVOptions.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2613
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2573
#define AV_PIX_FMT_FLAG_BITSTREAM
All values of a component are bit-wise packed end to end.
Definition: pixdesc.h:136
#define AV_PIX_FMT_FLAG_HWACCEL
Pixel format is an HW accelerated format.
Definition: pixdesc.h:140
#define AV_PIX_FMT_FLAG_PAL
Pixel format has a palette in data[1], values are indexes in this palette.
Definition: pixdesc.h:132
#define td
Definition: regdef.h:70
Describe the class of an AVClass context structure.
Definition: log.h:67
An instance of a filter.
Definition: avfilter.h:341
void * priv
private data for use by the filter
Definition: avfilter.h:356
A list of supported formats for one end of a filter link.
Definition: formats.h:65
A filter pad used for either input or output.
Definition: internal.h:54
const char * name
Pad name.
Definition: internal.h:60
Filter definition.
Definition: avfilter.h:145
const char * name
Filter name.
Definition: avfilter.h:149
AVFormatInternal * internal
An opaque field for libavformat internal usage.
Definition: avformat.h:1699
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
AVOption.
Definition: opt.h:248
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:81
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:92
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:101
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:83
Rational number (pair of numerator and denominator).
Definition: rational.h:58
int num
Numerator.
Definition: rational.h:59
Used for passing data between threads.
Definition: dsddec.c:67
AVFrame * out
Definition: af_adeclick.c:502
AVFrame * in
Definition: af_adenorm.c:223
TransVtable vtables[4]
Definition: vf_transpose.c:53
int pixsteps[4]
Definition: vf_transpose.c:48
int passthrough
PassthroughType, landscape passthrough mode enabled.
Definition: vf_transpose.c:50
int dir
TransposeDir.
Definition: vf_transpose.c:51
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
void(* transpose_8x8)(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: transpose.h:41
#define av_log(a,...)
#define src
Definition: vp8dsp.c:255
FILE * out
Definition: movenc.c:54
AVFormatContext * ctx
Definition: movenc.c:48
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
@ TRANSPOSE_CLOCK
Definition: transpose.h:32
void ff_transpose_init_x86(TransVtable *v, int pixstep)
@ TRANSPOSE_PT_TYPE_NONE
Definition: transpose.h:25
@ TRANSPOSE_PT_TYPE_PORTRAIT
Definition: transpose.h:27
@ TRANSPOSE_PT_TYPE_LANDSCAPE
Definition: transpose.h:26
static void hsub(htype *dst, const htype *src, int bins)
Definition: vf_median.c:76
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:126
AVFilter ff_vf_transpose
Definition: vf_transpose.c:401
static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_transpose.c:268
static void transpose_8x8_32_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:137
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:162
static int query_formats(AVFilterContext *ctx)
Definition: vf_transpose.c:56
static void transpose_8x8_64_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:172
#define FLAGS
Definition: vf_transpose.c:362
AVFILTER_DEFINE_CLASS(transpose)
static void transpose_8x8_24_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:120
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_transpose.c:330
static const AVFilterPad avfilter_vf_transpose_inputs[]
Definition: vf_transpose.c:382
static const AVOption transpose_options[]
Definition: vf_transpose.c:364
static void transpose_8x8_16_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:101
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition: vf_transpose.c:255
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:75
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:107
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:143
static int config_props_output(AVFilterLink *outlink)
Definition: vf_transpose.c:178
static void transpose_8x8_8_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:85
#define OFFSET(x)
Definition: vf_transpose.c:361
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:91
static void transpose_8x8_48_c(uint8_t *src, ptrdiff_t src_linesize, uint8_t *dst, ptrdiff_t dst_linesize)
Definition: vf_transpose.c:156
static const AVFilterPad avfilter_vf_transpose_outputs[]
Definition: vf_transpose.c:392
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:39
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:104
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
Definition: video.c:99