FFmpeg  4.4.8
vf_super2xsai.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2010 Niel van der Westhuizen <nielkie@gmail.com>
3  * Copyright (c) 2002 A'rpi
4  * Copyright (c) 1997-2001 ZSNES Team ( zsknight@zsnes.com / _demo_@zsnes.com )
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with FFmpeg; if not, write to the Free Software Foundation, Inc.,
20  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21  */
22 
23 /**
24  * @file
25  * Super 2xSaI video filter
26  * Ported from MPlayer libmpcodecs/vf_2xsai.c.
27  */
28 
29 #include "libavutil/pixdesc.h"
30 #include "libavutil/intreadwrite.h"
31 #include "avfilter.h"
32 #include "filters.h"
33 #include "formats.h"
34 #include "internal.h"
35 #include "video.h"
36 
37 typedef struct Super2xSaIContext {
38  /* masks used for two pixels interpolation */
39  uint32_t hi_pixel_mask;
40  uint32_t lo_pixel_mask;
41 
42  /* masks used for four pixels interpolation */
43  uint32_t q_hi_pixel_mask;
44  uint32_t q_lo_pixel_mask;
45 
46  int bpp; ///< bytes per pixel, pixel stride for each (packed) pixel
47  int is_be;
49 
50 typedef struct ThreadData {
51  AVFrame *in, *out;
52 } ThreadData;
53 
54 #define GET_RESULT(A, B, C, D) ((A != C || A != D) - (B != C || B != D))
55 
56 #define INTERPOLATE(A, B) (((A & hi_pixel_mask) >> 1) + ((B & hi_pixel_mask) >> 1) + (A & B & lo_pixel_mask))
57 
58 #define Q_INTERPOLATE(A, B, C, D) ((A & q_hi_pixel_mask) >> 2) + ((B & q_hi_pixel_mask) >> 2) + ((C & q_hi_pixel_mask) >> 2) + ((D & q_hi_pixel_mask) >> 2) \
59  + ((((A & q_lo_pixel_mask) + (B & q_lo_pixel_mask) + (C & q_lo_pixel_mask) + (D & q_lo_pixel_mask)) >> 2) & q_lo_pixel_mask)
60 
61 static int super2xsai(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
62 {
63  Super2xSaIContext *s = ctx->priv;
64  ThreadData *td = arg;
65  AVFrame *in = td->in;
66  AVFrame *out = td->out;
67  const uint8_t *src = in->data[0];
68  uint8_t *dst = out->data[0];
69  const int src_linesize = in->linesize[0];
70  const int dst_linesize = out->linesize[0];
71  const int width = in->width;
72  const int height = in->height;
73  unsigned int x, y;
74  uint32_t color[4][4];
75  const uint8_t *src_line[4];
76  const int bpp = s->bpp;
77  const uint32_t hi_pixel_mask = s->hi_pixel_mask;
78  const uint32_t lo_pixel_mask = s->lo_pixel_mask;
79  const uint32_t q_hi_pixel_mask = s->q_hi_pixel_mask;
80  const uint32_t q_lo_pixel_mask = s->q_lo_pixel_mask;
81  const int slice_start = ff_slice_pos(height, jobnr, nb_jobs);
82  const int slice_end = ff_slice_pos(height, jobnr + 1, nb_jobs);
83 
84  /* Point to the first 4 lines, first line is duplicated */
85  src_line[0] = src + src_linesize*FFMAX(slice_start - 1, 0);
86  src_line[1] = src + src_linesize*slice_start;
87  src_line[2] = src + src_linesize*FFMIN(slice_start + 1, height-1);
88  src_line[3] = src + src_linesize*FFMIN(slice_start + 2, height-1);
89 
90 #define READ_COLOR4(dst, src_line, off) dst = *((const uint32_t *)src_line + off)
91 #define READ_COLOR3(dst, src_line, off) dst = AV_RL24 (src_line + 3*off)
92 #define READ_COLOR2(dst, src_line, off) dst = s->is_be ? AV_RB16(src_line + 2 * off) : AV_RL16(src_line + 2 * off)
93 
94  for (y = slice_start; y < slice_end; y++) {
95  uint8_t *dst_line[2];
96 
97  dst_line[0] = dst + dst_linesize*2*y;
98  dst_line[1] = dst + dst_linesize*(2*y+1);
99 
100  switch (bpp) {
101  case 4:
102  READ_COLOR4(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR4(color[0][2], src_line[0], 1); READ_COLOR4(color[0][3], src_line[0], 2);
103  READ_COLOR4(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR4(color[1][2], src_line[1], 1); READ_COLOR4(color[1][3], src_line[1], 2);
104  READ_COLOR4(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR4(color[2][2], src_line[2], 1); READ_COLOR4(color[2][3], src_line[2], 2);
105  READ_COLOR4(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR4(color[3][2], src_line[3], 1); READ_COLOR4(color[3][3], src_line[3], 2);
106  break;
107  case 3:
108  READ_COLOR3(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR3(color[0][2], src_line[0], 1); READ_COLOR3(color[0][3], src_line[0], 2);
109  READ_COLOR3(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR3(color[1][2], src_line[1], 1); READ_COLOR3(color[1][3], src_line[1], 2);
110  READ_COLOR3(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR3(color[2][2], src_line[2], 1); READ_COLOR3(color[2][3], src_line[2], 2);
111  READ_COLOR3(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR3(color[3][2], src_line[3], 1); READ_COLOR3(color[3][3], src_line[3], 2);
112  break;
113  default:
114  READ_COLOR2(color[0][0], src_line[0], 0); color[0][1] = color[0][0]; READ_COLOR2(color[0][2], src_line[0], 1); READ_COLOR2(color[0][3], src_line[0], 2);
115  READ_COLOR2(color[1][0], src_line[1], 0); color[1][1] = color[1][0]; READ_COLOR2(color[1][2], src_line[1], 1); READ_COLOR2(color[1][3], src_line[1], 2);
116  READ_COLOR2(color[2][0], src_line[2], 0); color[2][1] = color[2][0]; READ_COLOR2(color[2][2], src_line[2], 1); READ_COLOR2(color[2][3], src_line[2], 2);
117  READ_COLOR2(color[3][0], src_line[3], 0); color[3][1] = color[3][0]; READ_COLOR2(color[3][2], src_line[3], 1); READ_COLOR2(color[3][3], src_line[3], 2);
118  }
119 
120  for (x = 0; x < width; x++) {
121  uint32_t product1a, product1b, product2a, product2b;
122 
123 //--------------------------------------- B0 B1 B2 B3 0 1 2 3
124 // 4 5* 6 S2 -> 4 5* 6 7
125 // 1 2 3 S1 8 9 10 11
126 // A0 A1 A2 A3 12 13 14 15
127 //--------------------------------------
128  if (color[2][1] == color[1][2] && color[1][1] != color[2][2]) {
129  product2b = color[2][1];
130  product1b = product2b;
131  } else if (color[1][1] == color[2][2] && color[2][1] != color[1][2]) {
132  product2b = color[1][1];
133  product1b = product2b;
134  } else if (color[1][1] == color[2][2] && color[2][1] == color[1][2]) {
135  int r = 0;
136 
137  r += GET_RESULT(color[1][2], color[1][1], color[1][0], color[3][1]);
138  r += GET_RESULT(color[1][2], color[1][1], color[2][0], color[0][1]);
139  r += GET_RESULT(color[1][2], color[1][1], color[3][2], color[2][3]);
140  r += GET_RESULT(color[1][2], color[1][1], color[0][2], color[1][3]);
141 
142  if (r > 0)
143  product1b = color[1][2];
144  else if (r < 0)
145  product1b = color[1][1];
146  else
147  product1b = INTERPOLATE(color[1][1], color[1][2]);
148 
149  product2b = product1b;
150  } else {
151  if (color[1][2] == color[2][2] && color[2][2] == color[3][1] && color[2][1] != color[3][2] && color[2][2] != color[3][0])
152  product2b = Q_INTERPOLATE(color[2][2], color[2][2], color[2][2], color[2][1]);
153  else if (color[1][1] == color[2][1] && color[2][1] == color[3][2] && color[3][1] != color[2][2] && color[2][1] != color[3][3])
154  product2b = Q_INTERPOLATE(color[2][1], color[2][1], color[2][1], color[2][2]);
155  else
156  product2b = INTERPOLATE(color[2][1], color[2][2]);
157 
158  if (color[1][2] == color[2][2] && color[1][2] == color[0][1] && color[1][1] != color[0][2] && color[1][2] != color[0][0])
159  product1b = Q_INTERPOLATE(color[1][2], color[1][2], color[1][2], color[1][1]);
160  else if (color[1][1] == color[2][1] && color[1][1] == color[0][2] && color[0][1] != color[1][2] && color[1][1] != color[0][3])
161  product1b = Q_INTERPOLATE(color[1][2], color[1][1], color[1][1], color[1][1]);
162  else
163  product1b = INTERPOLATE(color[1][1], color[1][2]);
164  }
165 
166  if (color[1][1] == color[2][2] && color[2][1] != color[1][2] && color[1][0] == color[1][1] && color[1][1] != color[3][2])
167  product2a = INTERPOLATE(color[2][1], color[1][1]);
168  else if (color[1][1] == color[2][0] && color[1][2] == color[1][1] && color[1][0] != color[2][1] && color[1][1] != color[3][0])
169  product2a = INTERPOLATE(color[2][1], color[1][1]);
170  else
171  product2a = color[2][1];
172 
173  if (color[2][1] == color[1][2] && color[1][1] != color[2][2] && color[2][0] == color[2][1] && color[2][1] != color[0][2])
174  product1a = INTERPOLATE(color[2][1], color[1][1]);
175  else if (color[1][0] == color[2][1] && color[2][2] == color[2][1] && color[2][0] != color[1][1] && color[2][1] != color[0][0])
176  product1a = INTERPOLATE(color[2][1], color[1][1]);
177  else
178  product1a = color[1][1];
179 
180  /* Set the calculated pixels */
181  switch (bpp) {
182  case 4:
183  AV_WN32A(dst_line[0] + x * 8, product1a);
184  AV_WN32A(dst_line[0] + x * 8 + 4, product1b);
185  AV_WN32A(dst_line[1] + x * 8, product2a);
186  AV_WN32A(dst_line[1] + x * 8 + 4, product2b);
187  break;
188  case 3:
189  AV_WL24(dst_line[0] + x * 6, product1a);
190  AV_WL24(dst_line[0] + x * 6 + 3, product1b);
191  AV_WL24(dst_line[1] + x * 6, product2a);
192  AV_WL24(dst_line[1] + x * 6 + 3, product2b);
193  break;
194  default: // bpp = 2
195  if (s->is_be) {
196  AV_WB32(dst_line[0] + x * 4, product1a | (product1b << 16));
197  AV_WB32(dst_line[1] + x * 4, product2a | (product2b << 16));
198  } else {
199  AV_WL32(dst_line[0] + x * 4, product1a | (product1b << 16));
200  AV_WL32(dst_line[1] + x * 4, product2a | (product2b << 16));
201  }
202  }
203 
204  /* Move color matrix forward */
205  color[0][0] = color[0][1]; color[0][1] = color[0][2]; color[0][2] = color[0][3];
206  color[1][0] = color[1][1]; color[1][1] = color[1][2]; color[1][2] = color[1][3];
207  color[2][0] = color[2][1]; color[2][1] = color[2][2]; color[2][2] = color[2][3];
208  color[3][0] = color[3][1]; color[3][1] = color[3][2]; color[3][2] = color[3][3];
209 
210  if (x < width - 3) {
211  x += 3;
212  switch (bpp) {
213  case 4:
214  READ_COLOR4(color[0][3], src_line[0], x);
215  READ_COLOR4(color[1][3], src_line[1], x);
216  READ_COLOR4(color[2][3], src_line[2], x);
217  READ_COLOR4(color[3][3], src_line[3], x);
218  break;
219  case 3:
220  READ_COLOR3(color[0][3], src_line[0], x);
221  READ_COLOR3(color[1][3], src_line[1], x);
222  READ_COLOR3(color[2][3], src_line[2], x);
223  READ_COLOR3(color[3][3], src_line[3], x);
224  break;
225  default: /* case 2 */
226  READ_COLOR2(color[0][3], src_line[0], x);
227  READ_COLOR2(color[1][3], src_line[1], x);
228  READ_COLOR2(color[2][3], src_line[2], x);
229  READ_COLOR2(color[3][3], src_line[3], x);
230  }
231  x -= 3;
232  }
233  }
234 
235  /* We're done with one line, so we shift the source lines up */
236  src_line[0] = src_line[1];
237  src_line[1] = src_line[2];
238  src_line[2] = src_line[3];
239 
240  /* Read next line */
241  src_line[3] = src_line[2];
242  if (y < height - 3)
243  src_line[3] += src_linesize;
244  } // y loop
245 
246  return 0;
247 }
248 
250 {
251  static const enum AVPixelFormat pix_fmts[] = {
257  };
258 
260  if (!fmts_list)
261  return AVERROR(ENOMEM);
262  return ff_set_common_formats(ctx, fmts_list);
263 }
264 
265 static int config_input(AVFilterLink *inlink)
266 {
267  Super2xSaIContext *s = inlink->dst->priv;
268 
269  s->hi_pixel_mask = 0xFEFEFEFE;
270  s->lo_pixel_mask = 0x01010101;
271  s->q_hi_pixel_mask = 0xFCFCFCFC;
272  s->q_lo_pixel_mask = 0x03030303;
273  s->bpp = 4;
274 
275  switch (inlink->format) {
276  case AV_PIX_FMT_RGB24:
277  case AV_PIX_FMT_BGR24:
278  s->bpp = 3;
279  break;
280 
281  case AV_PIX_FMT_RGB565BE:
282  case AV_PIX_FMT_BGR565BE:
283  s->is_be = 1;
284  case AV_PIX_FMT_RGB565LE:
285  case AV_PIX_FMT_BGR565LE:
286  s->hi_pixel_mask = 0xF7DEF7DE;
287  s->lo_pixel_mask = 0x08210821;
288  s->q_hi_pixel_mask = 0xE79CE79C;
289  s->q_lo_pixel_mask = 0x18631863;
290  s->bpp = 2;
291  break;
292 
293  case AV_PIX_FMT_BGR555BE:
294  case AV_PIX_FMT_RGB555BE:
295  s->is_be = 1;
296  case AV_PIX_FMT_BGR555LE:
297  case AV_PIX_FMT_RGB555LE:
298  s->hi_pixel_mask = 0x7BDE7BDE;
299  s->lo_pixel_mask = 0x04210421;
300  s->q_hi_pixel_mask = 0x739C739C;
301  s->q_lo_pixel_mask = 0x0C630C63;
302  s->bpp = 2;
303  break;
304  }
305 
306  return 0;
307 }
308 
309 static int config_output(AVFilterLink *outlink)
310 {
311  AVFilterLink *inlink = outlink->src->inputs[0];
312 
313  outlink->w = inlink->w*2;
314  outlink->h = inlink->h*2;
315 
316  av_log(inlink->dst, AV_LOG_VERBOSE, "fmt:%s size:%dx%d -> size:%dx%d\n",
317  av_get_pix_fmt_name(inlink->format),
318  inlink->w, inlink->h, outlink->w, outlink->h);
319 
320  return 0;
321 }
322 
323 static int filter_frame(AVFilterLink *inlink, AVFrame *in)
324 {
325  AVFilterContext *ctx = inlink->dst;
326  AVFilterLink *outlink = ctx->outputs[0];
327  ThreadData td;
328  AVFrame *out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
329  if (!out) {
330  av_frame_free(&in);
331  return AVERROR(ENOMEM);
332  }
334  out->width = outlink->w;
335  out->height = outlink->h;
336 
337  td.in = in, td.out = out;
338  ctx->internal->execute(ctx, super2xsai, &td, NULL, FFMIN(in->height, ff_filter_get_nb_threads(ctx)));
339 
340  av_frame_free(&in);
341  return ff_filter_frame(outlink, out);
342 }
343 
344 static const AVFilterPad super2xsai_inputs[] = {
345  {
346  .name = "default",
347  .type = AVMEDIA_TYPE_VIDEO,
348  .config_props = config_input,
349  .filter_frame = filter_frame,
350  },
351  { NULL }
352 };
353 
354 static const AVFilterPad super2xsai_outputs[] = {
355  {
356  .name = "default",
357  .type = AVMEDIA_TYPE_VIDEO,
358  .config_props = config_output,
359  },
360  { NULL }
361 };
362 
364  .name = "super2xsai",
365  .description = NULL_IF_CONFIG_SMALL("Scale the input by 2x using the Super2xSaI pixel art algorithm."),
366  .priv_size = sizeof(Super2xSaIContext),
371 };
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
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 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 FFMAX(a, b)
Definition: common.h:103
#define NULL
Definition: coverity.c:32
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
AVFilterFormats * ff_make_format_list(const int *fmts)
Create a list of supported formats.
Definition: formats.c:286
#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_VERBOSE
Detailed information.
Definition: log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
#define AV_WB32(p, v)
Definition: intreadwrite.h:419
#define AV_WL32(p, v)
Definition: intreadwrite.h:426
#define AV_WN32A(p, v)
Definition: intreadwrite.h:538
#define AV_WL24(p, d)
Definition: intreadwrite.h:464
const char * arg
Definition: jacosubdec.c:66
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
static int slice_end(AVCodecContext *avctx, AVFrame *pict)
Handle slice ends.
Definition: mpeg12dec.c:2033
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:2489
AVPixelFormat
Pixel format.
Definition: pixfmt.h:64
@ AV_PIX_FMT_NONE
Definition: pixfmt.h:65
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
@ AV_PIX_FMT_BGR565BE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian
Definition: pixfmt.h:110
@ AV_PIX_FMT_ARGB
packed ARGB 8:8:8:8, 32bpp, ARGBARGB...
Definition: pixfmt.h:92
@ AV_PIX_FMT_RGB555BE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:107
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:95
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
@ AV_PIX_FMT_RGB565LE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian
Definition: pixfmt.h:106
@ AV_PIX_FMT_RGB555LE
packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:108
@ AV_PIX_FMT_BGR555BE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined
Definition: pixfmt.h:112
@ AV_PIX_FMT_RGB565BE
packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian
Definition: pixfmt.h:105
@ AV_PIX_FMT_BGR555LE
packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined
Definition: pixfmt.h:113
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
Definition: pixfmt.h:69
@ AV_PIX_FMT_BGR565LE
packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian
Definition: pixfmt.h:111
#define td
Definition: regdef.h:70
An instance of a filter.
Definition: avfilter.h:341
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:349
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
uint32_t q_hi_pixel_mask
Definition: vf_super2xsai.c:43
int bpp
bytes per pixel, pixel stride for each (packed) pixel
Definition: vf_super2xsai.c:46
uint32_t q_lo_pixel_mask
Definition: vf_super2xsai.c:44
uint32_t hi_pixel_mask
Definition: vf_super2xsai.c:39
uint32_t lo_pixel_mask
Definition: vf_super2xsai.c:40
Used for passing data between threads.
Definition: dsddec.c:67
AVFrame * out
Definition: af_adeclick.c:502
AVFrame * in
Definition: af_adenorm.c:223
#define av_log(a,...)
#define src
Definition: vp8dsp.c:255
FILE * out
Definition: movenc.c:54
AVFormatContext * ctx
Definition: movenc.c:48
#define height
#define width
const char * r
Definition: vf_curves.c:117
#define READ_COLOR2(dst, src_line, off)
static int query_formats(AVFilterContext *ctx)
static int config_input(AVFilterLink *inlink)
AVFilter ff_vf_super2xsai
static const AVFilterPad super2xsai_outputs[]
#define Q_INTERPOLATE(A, B, C, D)
Definition: vf_super2xsai.c:58
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
#define READ_COLOR3(dst, src_line, off)
static int super2xsai(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
Definition: vf_super2xsai.c:61
#define GET_RESULT(A, B, C, D)
Definition: vf_super2xsai.c:54
static int config_output(AVFilterLink *outlink)
#define READ_COLOR4(dst, src_line, off)
#define INTERPOLATE(A, B)
Definition: vf_super2xsai.c:56
static const AVFilterPad super2xsai_inputs[]
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