FFmpeg
dpx.c
Go to the documentation of this file.
1 /*
2  * DPX (.dpx) image decoder
3  * Copyright (c) 2009 Jimmy Christensen
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 #include "libavutil/avstring.h"
23 #include "libavutil/intreadwrite.h"
24 #include "libavutil/intfloat.h"
25 #include "libavutil/imgutils.h"
26 #include "bytestream.h"
27 #include "avcodec.h"
28 #include "internal.h"
29 
30 static unsigned int read16(const uint8_t **ptr, int is_big)
31 {
32  unsigned int temp;
33  if (is_big) {
34  temp = AV_RB16(*ptr);
35  } else {
36  temp = AV_RL16(*ptr);
37  }
38  *ptr += 2;
39  return temp;
40 }
41 
42 static unsigned int read32(const uint8_t **ptr, int is_big)
43 {
44  unsigned int temp;
45  if (is_big) {
46  temp = AV_RB32(*ptr);
47  } else {
48  temp = AV_RL32(*ptr);
49  }
50  *ptr += 4;
51  return temp;
52 }
53 
54 static uint16_t read10in32_gray(const uint8_t **ptr, uint32_t *lbuf,
55  int *n_datum, int is_big, int shift)
56 {
57  uint16_t temp;
58 
59  if (*n_datum)
60  (*n_datum)--;
61  else {
62  *lbuf = read32(ptr, is_big);
63  *n_datum = 2;
64  }
65 
66  temp = *lbuf >> shift & 0x3FF;
67  *lbuf = *lbuf >> 10;
68 
69  return temp;
70 }
71 
72 static uint16_t read10in32(const uint8_t **ptr, uint32_t *lbuf,
73  int *n_datum, int is_big, int shift)
74 {
75  if (*n_datum)
76  (*n_datum)--;
77  else {
78  *lbuf = read32(ptr, is_big);
79  *n_datum = 2;
80  }
81 
82  *lbuf = *lbuf << 10 | *lbuf >> shift & 0x3FFFFF;
83 
84  return *lbuf & 0x3FF;
85 }
86 
87 static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf,
88  int *n_datum, int is_big)
89 {
90  if (*n_datum)
91  (*n_datum)--;
92  else {
93  *lbuf = read32(ptr, is_big);
94  *n_datum = 7;
95  }
96 
97  switch (*n_datum){
98  case 7: return *lbuf & 0xFFF;
99  case 6: return (*lbuf >> 12) & 0xFFF;
100  case 5: {
101  uint32_t c = *lbuf >> 24;
102  *lbuf = read32(ptr, is_big);
103  c |= *lbuf << 8;
104  return c & 0xFFF;
105  }
106  case 4: return (*lbuf >> 4) & 0xFFF;
107  case 3: return (*lbuf >> 16) & 0xFFF;
108  case 2: {
109  uint32_t c = *lbuf >> 28;
110  *lbuf = read32(ptr, is_big);
111  c |= *lbuf << 4;
112  return c & 0xFFF;
113  }
114  case 1: return (*lbuf >> 8) & 0xFFF;
115  default: return *lbuf >> 20;
116  }
117 }
118 
119 static int decode_frame(AVCodecContext *avctx,
120  void *data,
121  int *got_frame,
122  AVPacket *avpkt)
123 {
124  const uint8_t *buf = avpkt->data;
125  int buf_size = avpkt->size;
126  AVFrame *const p = data;
128  uint32_t header_version, version = 0;
129  char creator[101];
130  char input_device[33];
131 
132  unsigned int offset;
133  int magic_num, endian;
134  int x, y, stride, i, ret;
135  int w, h, bits_per_color, descriptor, elements, packing;
136  int encoding, need_align = 0;
137 
138  unsigned int rgbBuffer = 0;
139  int n_datum = 0;
140 
141  if (avpkt->size <= 1634) {
142  av_log(avctx, AV_LOG_ERROR, "Packet too small for DPX header\n");
143  return AVERROR_INVALIDDATA;
144  }
145 
146  magic_num = AV_RB32(buf);
147  buf += 4;
148 
149  /* Check if the files "magic number" is "SDPX" which means it uses
150  * big-endian or XPDS which is for little-endian files */
151  if (magic_num == AV_RL32("SDPX")) {
152  endian = 0;
153  } else if (magic_num == AV_RB32("SDPX")) {
154  endian = 1;
155  } else {
156  av_log(avctx, AV_LOG_ERROR, "DPX marker not found\n");
157  return AVERROR_INVALIDDATA;
158  }
159 
160  offset = read32(&buf, endian);
161  if (avpkt->size <= offset) {
162  av_log(avctx, AV_LOG_ERROR, "Invalid data start offset\n");
163  return AVERROR_INVALIDDATA;
164  }
165 
166  header_version = read32(&buf, 0);
167  if (header_version == MKTAG('V','1','.','0'))
168  version = 1;
169  if (header_version == MKTAG('V','2','.','0'))
170  version = 2;
171  if (!version)
172  av_log(avctx, AV_LOG_WARNING, "Unknown header format version %s.\n",
173  av_fourcc2str(header_version));
174 
175  // Check encryption
176  buf = avpkt->data + 660;
177  ret = read32(&buf, endian);
178  if (ret != 0xFFFFFFFF) {
179  avpriv_report_missing_feature(avctx, "Encryption");
180  av_log(avctx, AV_LOG_WARNING, "The image is encrypted and may "
181  "not properly decode.\n");
182  }
183 
184  // Need to end in 0x304 offset from start of file
185  buf = avpkt->data + 0x304;
186  w = read32(&buf, endian);
187  h = read32(&buf, endian);
188 
189  if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
190  return ret;
191 
192  // Need to end in 0x320 to read the descriptor
193  buf += 20;
194  descriptor = buf[0];
195 
196  // Need to end in 0x323 to read the bits per color
197  buf += 3;
198  avctx->bits_per_raw_sample =
199  bits_per_color = buf[0];
200  buf++;
201  packing = read16(&buf, endian);
202  encoding = read16(&buf, endian);
203 
204  if (encoding) {
205  avpriv_report_missing_feature(avctx, "Encoding %d", encoding);
206  return AVERROR_PATCHWELCOME;
207  }
208 
209  if (bits_per_color > 32)
210  return AVERROR_INVALIDDATA;
211 
212  buf += 820;
213  avctx->sample_aspect_ratio.num = read32(&buf, endian);
214  avctx->sample_aspect_ratio.den = read32(&buf, endian);
215  if (avctx->sample_aspect_ratio.num > 0 && avctx->sample_aspect_ratio.den > 0)
218  0x10000);
219  else
220  avctx->sample_aspect_ratio = (AVRational){ 0, 1 };
221 
222  if (offset >= 1724 + 4) {
223  buf = avpkt->data + 1724;
224  i = read32(&buf, endian);
225  if(i) {
226  AVRational q = av_d2q(av_int2float(i), 4096);
227  if (q.num > 0 && q.den > 0)
228  avctx->framerate = q;
229  }
230  }
231 
232  switch (descriptor) {
233  case 6: // Y
234  elements = 1;
235  break;
236  case 52: // ABGR
237  case 51: // RGBA
238  case 103: // UYVA4444
239  elements = 4;
240  break;
241  case 50: // RGB
242  case 102: // UYV444
243  elements = 3;
244  break;
245  case 100: // UYVY422
246  elements = 2;
247  break;
248  default:
249  avpriv_report_missing_feature(avctx, "Descriptor %d", descriptor);
250  return AVERROR_PATCHWELCOME;
251  }
252 
253  switch (bits_per_color) {
254  case 8:
255  stride = avctx->width * elements;
256  break;
257  case 10:
258  if (!packing) {
259  av_log(avctx, AV_LOG_ERROR, "Packing to 32bit required\n");
260  return -1;
261  }
262  stride = (avctx->width * elements + 2) / 3 * 4;
263  break;
264  case 12:
265  stride = avctx->width * elements;
266  if (packing) {
267  stride *= 2;
268  } else {
269  stride *= 3;
270  if (stride % 8) {
271  stride /= 8;
272  stride++;
273  stride *= 8;
274  }
275  stride /= 2;
276  }
277  break;
278  case 16:
279  stride = 2 * avctx->width * elements;
280  break;
281  case 1:
282  case 32:
283  case 64:
284  avpriv_report_missing_feature(avctx, "Depth %d", bits_per_color);
285  return AVERROR_PATCHWELCOME;
286  default:
287  return AVERROR_INVALIDDATA;
288  }
289 
290  // Table 3c: Runs will always break at scan line boundaries. Packing
291  // will always break to the next 32-bit word at scan-line boundaries.
292  // Unfortunately, the encoder produced invalid files, so attempt
293  // to detect it
294  need_align = FFALIGN(stride, 4);
295  if (need_align*avctx->height + (int64_t)offset > avpkt->size) {
296  // Alignment seems unappliable, try without
297  if (stride*avctx->height + (int64_t)offset > avpkt->size) {
298  av_log(avctx, AV_LOG_ERROR, "Overread buffer. Invalid header?\n");
299  return AVERROR_INVALIDDATA;
300  } else {
301  av_log(avctx, AV_LOG_INFO, "Decoding DPX without scanline "
302  "alignment.\n");
303  need_align = 0;
304  }
305  } else {
306  need_align -= stride;
307  stride = FFALIGN(stride, 4);
308  }
309 
310  switch (1000 * descriptor + 10 * bits_per_color + endian) {
311  case 6081:
312  case 6080:
313  avctx->pix_fmt = AV_PIX_FMT_GRAY8;
314  break;
315  case 6121:
316  case 6120:
317  avctx->pix_fmt = AV_PIX_FMT_GRAY12;
318  break;
319  case 50081:
320  case 50080:
321  avctx->pix_fmt = AV_PIX_FMT_RGB24;
322  break;
323  case 52081:
324  case 52080:
325  avctx->pix_fmt = AV_PIX_FMT_ABGR;
326  break;
327  case 51081:
328  case 51080:
329  avctx->pix_fmt = AV_PIX_FMT_RGBA;
330  break;
331  case 50100:
332  case 50101:
333  avctx->pix_fmt = AV_PIX_FMT_GBRP10;
334  break;
335  case 51100:
336  case 51101:
337  avctx->pix_fmt = AV_PIX_FMT_GBRAP10;
338  break;
339  case 50120:
340  case 50121:
341  avctx->pix_fmt = AV_PIX_FMT_GBRP12;
342  break;
343  case 51120:
344  case 51121:
345  avctx->pix_fmt = AV_PIX_FMT_GBRAP12;
346  break;
347  case 6100:
348  case 6101:
349  avctx->pix_fmt = AV_PIX_FMT_GRAY10;
350  break;
351  case 6161:
352  avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
353  break;
354  case 6160:
355  avctx->pix_fmt = AV_PIX_FMT_GRAY16LE;
356  break;
357  case 50161:
358  avctx->pix_fmt = AV_PIX_FMT_RGB48BE;
359  break;
360  case 50160:
361  avctx->pix_fmt = AV_PIX_FMT_RGB48LE;
362  break;
363  case 51161:
364  avctx->pix_fmt = AV_PIX_FMT_RGBA64BE;
365  break;
366  case 51160:
367  avctx->pix_fmt = AV_PIX_FMT_RGBA64LE;
368  break;
369  case 100081:
370  avctx->pix_fmt = AV_PIX_FMT_UYVY422;
371  break;
372  case 102081:
373  avctx->pix_fmt = AV_PIX_FMT_YUV444P;
374  break;
375  case 103081:
376  avctx->pix_fmt = AV_PIX_FMT_YUVA444P;
377  break;
378  default:
379  av_log(avctx, AV_LOG_ERROR, "Unsupported format\n");
380  return AVERROR_PATCHWELCOME;
381  }
382 
383  ff_set_sar(avctx, avctx->sample_aspect_ratio);
384 
385  if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
386  return ret;
387 
388  av_strlcpy(creator, avpkt->data + 160, 100);
389  creator[100] = '\0';
390  av_dict_set(&p->metadata, "Creator", creator, 0);
391 
392  av_strlcpy(input_device, avpkt->data + 1556, 32);
393  input_device[32] = '\0';
394  av_dict_set(&p->metadata, "Input Device", input_device, 0);
395 
396  // Move pointer to offset from start of file
397  buf = avpkt->data + offset;
398 
399  for (i=0; i<AV_NUM_DATA_POINTERS; i++)
400  ptr[i] = p->data[i];
401 
402  switch (bits_per_color) {
403  case 10:
404  for (x = 0; x < avctx->height; x++) {
405  uint16_t *dst[4] = {(uint16_t*)ptr[0],
406  (uint16_t*)ptr[1],
407  (uint16_t*)ptr[2],
408  (uint16_t*)ptr[3]};
409  int shift = elements > 1 ? packing == 1 ? 22 : 20 : packing == 1 ? 2 : 0;
410  for (y = 0; y < avctx->width; y++) {
411  if (elements >= 3)
412  *dst[2]++ = read10in32(&buf, &rgbBuffer,
413  &n_datum, endian, shift);
414  if (elements == 1)
415  *dst[0]++ = read10in32_gray(&buf, &rgbBuffer,
416  &n_datum, endian, shift);
417  else
418  *dst[0]++ = read10in32(&buf, &rgbBuffer,
419  &n_datum, endian, shift);
420  if (elements >= 2)
421  *dst[1]++ = read10in32(&buf, &rgbBuffer,
422  &n_datum, endian, shift);
423  if (elements == 4)
424  *dst[3]++ =
425  read10in32(&buf, &rgbBuffer,
426  &n_datum, endian, shift);
427  }
428  if (memcmp(input_device, "Scanity", 7))
429  n_datum = 0;
430  for (i = 0; i < elements; i++)
431  ptr[i] += p->linesize[i];
432  }
433  break;
434  case 12:
435  for (x = 0; x < avctx->height; x++) {
436  uint16_t *dst[4] = {(uint16_t*)ptr[0],
437  (uint16_t*)ptr[1],
438  (uint16_t*)ptr[2],
439  (uint16_t*)ptr[3]};
440  int shift = packing == 1 ? 4 : 0;
441  for (y = 0; y < avctx->width; y++) {
442  if (packing) {
443  if (elements >= 3)
444  *dst[2]++ = read16(&buf, endian) >> shift & 0xFFF;
445  *dst[0]++ = read16(&buf, endian) >> shift & 0xFFF;
446  if (elements >= 2)
447  *dst[1]++ = read16(&buf, endian) >> shift & 0xFFF;
448  if (elements == 4)
449  *dst[3]++ = read16(&buf, endian) >> shift & 0xFFF;
450  } else {
451  if (elements >= 3)
452  *dst[2]++ = read12in32(&buf, &rgbBuffer,
453  &n_datum, endian);
454  *dst[0]++ = read12in32(&buf, &rgbBuffer,
455  &n_datum, endian);
456  if (elements >= 2)
457  *dst[1]++ = read12in32(&buf, &rgbBuffer,
458  &n_datum, endian);
459  if (elements == 4)
460  *dst[3]++ = read12in32(&buf, &rgbBuffer,
461  &n_datum, endian);
462  }
463  }
464  n_datum = 0;
465  for (i = 0; i < elements; i++)
466  ptr[i] += p->linesize[i];
467  // Jump to next aligned position
468  buf += need_align;
469  }
470  break;
471  case 16:
472  elements *= 2;
473  case 8:
474  if ( avctx->pix_fmt == AV_PIX_FMT_YUVA444P
475  || avctx->pix_fmt == AV_PIX_FMT_YUV444P) {
476  for (x = 0; x < avctx->height; x++) {
477  ptr[0] = p->data[0] + x * p->linesize[0];
478  ptr[1] = p->data[1] + x * p->linesize[1];
479  ptr[2] = p->data[2] + x * p->linesize[2];
480  ptr[3] = p->data[3] + x * p->linesize[3];
481  for (y = 0; y < avctx->width; y++) {
482  *ptr[1]++ = *buf++;
483  *ptr[0]++ = *buf++;
484  *ptr[2]++ = *buf++;
485  if (avctx->pix_fmt == AV_PIX_FMT_YUVA444P)
486  *ptr[3]++ = *buf++;
487  }
488  }
489  } else {
490  av_image_copy_plane(ptr[0], p->linesize[0],
491  buf, stride,
492  elements * avctx->width, avctx->height);
493  }
494  break;
495  }
496 
497  *got_frame = 1;
498 
499  return buf_size;
500 }
501 
503  .name = "dpx",
504  .long_name = NULL_IF_CONFIG_SMALL("DPX (Digital Picture Exchange) image"),
505  .type = AVMEDIA_TYPE_VIDEO,
506  .id = AV_CODEC_ID_DPX,
507  .decode = decode_frame,
508  .capabilities = AV_CODEC_CAP_DR1,
509 };
AVCodec
AVCodec.
Definition: codec.h:190
stride
int stride
Definition: mace.c:144
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
AV_CODEC_ID_DPX
@ AV_CODEC_ID_DPX
Definition: codec_id.h:177
elements
static const ElemCat * elements[ELEMENT_COUNT]
Definition: signature.h:566
MKTAG
#define MKTAG(a, b, c, d)
Definition: common.h:406
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:300
AV_PIX_FMT_RGBA64BE
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:205
read10in32_gray
static uint16_t read10in32_gray(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
Definition: dpx.c:54
w
uint8_t w
Definition: llviddspenc.c:38
internal.h
AVPacket::data
uint8_t * data
Definition: packet.h:355
data
const char data[16]
Definition: mxf.c:91
intfloat.h
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:314
av_image_copy_plane
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
Definition: imgutils.c:338
AVCodecContext::framerate
AVRational framerate
Definition: avcodec.h:2069
AV_PIX_FMT_GRAY16BE
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
decode_frame
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: dpx.c:119
av_int2float
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:413
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:417
intreadwrite.h
AV_PIX_FMT_GBRAP12
#define AV_PIX_FMT_GBRAP12
Definition: pixfmt.h:418
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1757
AV_RL16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
Definition: bytestream.h:90
AV_PIX_FMT_RGBA
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
Definition: pixfmt.h:93
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:378
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
AV_PIX_FMT_RGB48LE
@ AV_PIX_FMT_RGB48LE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...
Definition: pixfmt.h:103
AV_PIX_FMT_RGBA64LE
@ AV_PIX_FMT_RGBA64LE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
Definition: pixfmt.h:206
AV_PIX_FMT_GRAY8
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
Definition: pixfmt.h:74
AV_PIX_FMT_ABGR
@ AV_PIX_FMT_ABGR
packed ABGR 8:8:8:8, 32bpp, ABGRABGR...
Definition: pixfmt.h:94
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
read12in32
static uint16_t read12in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big)
Definition: dpx.c:87
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1854
AV_PIX_FMT_RGB24
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Definition: pixfmt.h:68
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:50
AVPacket::size
int size
Definition: packet.h:356
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:188
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:301
AV_RB32
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_RB32
Definition: bytestream.h:92
avpriv_report_missing_feature
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
ff_dpx_decoder
AVCodec ff_dpx_decoder
Definition: dpx.c:502
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:177
offset
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
Definition: writing_filters.txt:86
version
version
Definition: libkvazaar.c:292
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:187
read16
static unsigned int read16(const uint8_t **ptr, int is_big)
Definition: dpx.c:30
AV_PIX_FMT_RGB48BE
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
Definition: pixfmt.h:102
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
read10in32
static uint16_t read10in32(const uint8_t **ptr, uint32_t *lbuf, int *n_datum, int is_big, int shift)
Definition: dpx.c:72
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:414
av_d2q
AVRational av_d2q(double d, int max)
Convert a double precision floating point number to a rational.
Definition: rational.c:106
uint8_t
uint8_t
Definition: audio_convert.c:194
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:197
AVCodecContext::height
int height
Definition: avcodec.h:699
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:736
avcodec.h
ret
ret
Definition: filter_design.txt:187
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:81
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:88
ff_set_sar
int ff_set_sar(AVCodecContext *avctx, AVRational sar)
Check that the provided sample aspect ratio is valid and set it on the codec context.
Definition: utils.c:119
AVCodecContext
main external API structure.
Definition: avcodec.h:526
AVRational::den
int den
Denominator.
Definition: rational.h:60
AVFrame::metadata
AVDictionary * metadata
metadata.
Definition: frame.h:586
temp
else temp
Definition: vf_mcdeint.c:256
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:71
shift
static int shift(int a, int b)
Definition: sonic.c:82
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AV_PIX_FMT_GRAY16LE
@ AV_PIX_FMT_GRAY16LE
Y , 16bpp, little-endian.
Definition: pixfmt.h:98
ff_set_dimensions
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
Definition: utils.c:104
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:48
AVPacket
This structure stores compressed data.
Definition: packet.h:332
av_dict_set
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
Definition: dict.c:70
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:699
bytestream.h
imgutils.h
AVFrame::linesize
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:331
av_strlcpy
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
Definition: avstring.c:83
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
h
h
Definition: vp9dsp_template.c:2038
read32
static unsigned int read32(const uint8_t **ptr, int is_big)
Definition: dpx.c:42
avstring.h
AV_PIX_FMT_GRAY12
#define AV_PIX_FMT_GRAY12
Definition: pixfmt.h:379
AVCodecContext::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.
Definition: avcodec.h:905
AV_RB16
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_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:94
av_fourcc2str
#define av_fourcc2str(fourcc)
Definition: avutil.h:348