FFmpeg
xpmdec.c
Go to the documentation of this file.
1 /*
2  * XPM image format
3  *
4  * Copyright (c) 2012 Paul B Mahol
5  * Copyright (c) 2017 Paras Chadha
6  *
7  * This file is part of FFmpeg.
8  *
9  * FFmpeg is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU Lesser General Public
11  * License as published by the Free Software Foundation; either
12  * version 2.1 of the License, or (at your option) any later version.
13  *
14  * FFmpeg is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * Lesser General Public License for more details.
18  *
19  * You should have received a copy of the GNU Lesser General Public
20  * License along with FFmpeg; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  */
23 
24 #include "libavutil/avstring.h"
25 #include "avcodec.h"
26 #include "codec_internal.h"
27 #include "decode.h"
28 
29 #define MIN_ELEMENT ' '
30 #define MAX_ELEMENT 0xfe
31 #define NB_ELEMENTS (MAX_ELEMENT - MIN_ELEMENT + 1)
32 
33 typedef struct XPMContext {
34  uint32_t *pixels;
36  uint8_t *buf;
37  int buf_size;
38 } XPMDecContext;
39 
40 typedef struct ColorEntry {
41  const char *name; ///< a string representing the name of the color
42  uint32_t rgb_color; ///< RGB values for the color
43 } ColorEntry;
44 
45 static int color_table_compare(const void *lhs, const void *rhs)
46 {
47  return av_strcasecmp(lhs, ((const ColorEntry *)rhs)->name);
48 }
49 
50 static const ColorEntry color_table[] = {
51  { "AliceBlue", 0xFFF0F8FF },
52  { "AntiqueWhite", 0xFFFAEBD7 },
53  { "Aqua", 0xFF00FFFF },
54  { "Aquamarine", 0xFF7FFFD4 },
55  { "Azure", 0xFFF0FFFF },
56  { "Beige", 0xFFF5F5DC },
57  { "Bisque", 0xFFFFE4C4 },
58  { "Black", 0xFF000000 },
59  { "BlanchedAlmond", 0xFFFFEBCD },
60  { "Blue", 0xFF0000FF },
61  { "BlueViolet", 0xFF8A2BE2 },
62  { "Brown", 0xFFA52A2A },
63  { "BurlyWood", 0xFFDEB887 },
64  { "CadetBlue", 0xFF5F9EA0 },
65  { "Chartreuse", 0xFF7FFF00 },
66  { "Chocolate", 0xFFD2691E },
67  { "Coral", 0xFFFF7F50 },
68  { "CornflowerBlue", 0xFF6495ED },
69  { "Cornsilk", 0xFFFFF8DC },
70  { "Crimson", 0xFFDC143C },
71  { "Cyan", 0xFF00FFFF },
72  { "DarkBlue", 0xFF00008B },
73  { "DarkCyan", 0xFF008B8B },
74  { "DarkGoldenRod", 0xFFB8860B },
75  { "DarkGray", 0xFFA9A9A9 },
76  { "DarkGreen", 0xFF006400 },
77  { "DarkKhaki", 0xFFBDB76B },
78  { "DarkMagenta", 0xFF8B008B },
79  { "DarkOliveGreen", 0xFF556B2F },
80  { "Darkorange", 0xFFFF8C00 },
81  { "DarkOrchid", 0xFF9932CC },
82  { "DarkRed", 0xFF8B0000 },
83  { "DarkSalmon", 0xFFE9967A },
84  { "DarkSeaGreen", 0xFF8FBC8F },
85  { "DarkSlateBlue", 0xFF483D8B },
86  { "DarkSlateGray", 0xFF2F4F4F },
87  { "DarkTurquoise", 0xFF00CED1 },
88  { "DarkViolet", 0xFF9400D3 },
89  { "DeepPink", 0xFFFF1493 },
90  { "DeepSkyBlue", 0xFF00BFFF },
91  { "DimGray", 0xFF696969 },
92  { "DodgerBlue", 0xFF1E90FF },
93  { "FireBrick", 0xFFB22222 },
94  { "FloralWhite", 0xFFFFFAF0 },
95  { "ForestGreen", 0xFF228B22 },
96  { "Fuchsia", 0xFFFF00FF },
97  { "Gainsboro", 0xFFDCDCDC },
98  { "GhostWhite", 0xFFF8F8FF },
99  { "Gold", 0xFFFFD700 },
100  { "GoldenRod", 0xFFDAA520 },
101  { "Gray", 0xFFBEBEBE },
102  { "Green", 0xFF00FF00 },
103  { "GreenYellow", 0xFFADFF2F },
104  { "HoneyDew", 0xFFF0FFF0 },
105  { "HotPink", 0xFFFF69B4 },
106  { "IndianRed", 0xFFCD5C5C },
107  { "Indigo", 0xFF4B0082 },
108  { "Ivory", 0xFFFFFFF0 },
109  { "Khaki", 0xFFF0E68C },
110  { "Lavender", 0xFFE6E6FA },
111  { "LavenderBlush", 0xFFFFF0F5 },
112  { "LawnGreen", 0xFF7CFC00 },
113  { "LemonChiffon", 0xFFFFFACD },
114  { "LightBlue", 0xFFADD8E6 },
115  { "LightCoral", 0xFFF08080 },
116  { "LightCyan", 0xFFE0FFFF },
117  { "LightGoldenRodYellow", 0xFFFAFAD2 },
118  { "LightGreen", 0xFF90EE90 },
119  { "LightGrey", 0xFFD3D3D3 },
120  { "LightPink", 0xFFFFB6C1 },
121  { "LightSalmon", 0xFFFFA07A },
122  { "LightSeaGreen", 0xFF20B2AA },
123  { "LightSkyBlue", 0xFF87CEFA },
124  { "LightSlateGray", 0xFF778899 },
125  { "LightSteelBlue", 0xFFB0C4DE },
126  { "LightYellow", 0xFFFFFFE0 },
127  { "Lime", 0xFF00FF00 },
128  { "LimeGreen", 0xFF32CD32 },
129  { "Linen", 0xFFFAF0E6 },
130  { "Magenta", 0xFFFF00FF },
131  { "Maroon", 0xFFB03060 },
132  { "MediumAquaMarine", 0xFF66CDAA },
133  { "MediumBlue", 0xFF0000CD },
134  { "MediumOrchid", 0xFFBA55D3 },
135  { "MediumPurple", 0xFF9370D8 },
136  { "MediumSeaGreen", 0xFF3CB371 },
137  { "MediumSlateBlue", 0xFF7B68EE },
138  { "MediumSpringGreen", 0xFF00FA9A },
139  { "MediumTurquoise", 0xFF48D1CC },
140  { "MediumVioletRed", 0xFFC71585 },
141  { "MidnightBlue", 0xFF191970 },
142  { "MintCream", 0xFFF5FFFA },
143  { "MistyRose", 0xFFFFE4E1 },
144  { "Moccasin", 0xFFFFE4B5 },
145  { "NavajoWhite", 0xFFFFDEAD },
146  { "Navy", 0xFF000080 },
147  { "None", 0x00000000 },
148  { "OldLace", 0xFFFDF5E6 },
149  { "Olive", 0xFF808000 },
150  { "OliveDrab", 0xFF6B8E23 },
151  { "Orange", 0xFFFFA500 },
152  { "OrangeRed", 0xFFFF4500 },
153  { "Orchid", 0xFFDA70D6 },
154  { "PaleGoldenRod", 0xFFEEE8AA },
155  { "PaleGreen", 0xFF98FB98 },
156  { "PaleTurquoise", 0xFFAFEEEE },
157  { "PaleVioletRed", 0xFFD87093 },
158  { "PapayaWhip", 0xFFFFEFD5 },
159  { "PeachPuff", 0xFFFFDAB9 },
160  { "Peru", 0xFFCD853F },
161  { "Pink", 0xFFFFC0CB },
162  { "Plum", 0xFFDDA0DD },
163  { "PowderBlue", 0xFFB0E0E6 },
164  { "Purple", 0xFFA020F0 },
165  { "Red", 0xFFFF0000 },
166  { "RosyBrown", 0xFFBC8F8F },
167  { "RoyalBlue", 0xFF4169E1 },
168  { "SaddleBrown", 0xFF8B4513 },
169  { "Salmon", 0xFFFA8072 },
170  { "SandyBrown", 0xFFF4A460 },
171  { "SeaGreen", 0xFF2E8B57 },
172  { "SeaShell", 0xFFFFF5EE },
173  { "Sienna", 0xFFA0522D },
174  { "Silver", 0xFFC0C0C0 },
175  { "SkyBlue", 0xFF87CEEB },
176  { "SlateBlue", 0xFF6A5ACD },
177  { "SlateGray", 0xFF708090 },
178  { "Snow", 0xFFFFFAFA },
179  { "SpringGreen", 0xFF00FF7F },
180  { "SteelBlue", 0xFF4682B4 },
181  { "Tan", 0xFFD2B48C },
182  { "Teal", 0xFF008080 },
183  { "Thistle", 0xFFD8BFD8 },
184  { "Tomato", 0xFFFF6347 },
185  { "Turquoise", 0xFF40E0D0 },
186  { "Violet", 0xFFEE82EE },
187  { "Wheat", 0xFFF5DEB3 },
188  { "White", 0xFFFFFFFF },
189  { "WhiteSmoke", 0xFFF5F5F5 },
190  { "Yellow", 0xFFFFFF00 },
191  { "YellowGreen", 0xFF9ACD32 }
192 };
193 
194 static unsigned hex_char_to_number(uint8_t x)
195 {
196 #define TIMES256(idx) \
197 TIMES64(4 * (idx)) TIMES64(4 * (idx) + 1) TIMES64(4 * (idx) + 2) TIMES64(4 * (idx) + 3)
198 #define TIMES64(idx) \
199 TIMES16(4 * (idx)) TIMES16(4 * (idx) + 1) TIMES16(4 * (idx) + 2) TIMES16(4 * (idx) + 3)
200 #define TIMES16(idx) \
201 TIMES4(4 * (idx)) TIMES4(4 * (idx) + 1) TIMES4(4 * (idx) + 2) TIMES4(4 * (idx) + 3)
202 #define TIMES4(idx) \
203 ENTRY(4 * (idx)) ENTRY(4 * (idx) + 1) ENTRY(4 * (idx) + 2) ENTRY(4 * (idx) + 3)
204 #define ENTRY(x) [x] = ((x) >= 'a' && (x) <= 'f') ? (x) - ('a' - 10) : \
205  ((x) >= 'A' && (x) <= 'F') ? (x) - ('A' - 10) : \
206  ((x) >= '0' && (x) <= '9') ? (x) - '0' : 0,
207 
208  static const uint8_t lut[] = {
209  TIMES256(0)
210  };
211  return lut[x];
212 }
213 
214 /*
215  * Function same as strcspn but ignores characters if they are inside a C style comments
216  */
217 static size_t mod_strcspn(const char *string, const char *reject)
218 {
219  int i, j;
220 
221  for (i = 0; string && string[i]; i++) {
222  if (string[i] == '/' && string[i+1] == '*') {
223  i += 2;
224  while ( string && string[i] && (string[i] != '*' || string[i+1] != '/') )
225  i++;
226  i++;
227  } else if (string[i] == '/' && string[i+1] == '/') {
228  i += 2;
229  while ( string && string[i] && string[i] != '\n' )
230  i++;
231  } else {
232  for (j = 0; reject && reject[j]; j++) {
233  if (string[i] == reject[j])
234  break;
235  }
236  if (reject && reject[j])
237  break;
238  }
239  }
240  return i;
241 }
242 
243 static uint32_t color_string_to_rgba(const char *p, size_t len)
244 {
245  uint32_t ret = 0xFF000000;
246  const ColorEntry *entry;
247  char color_name[100];
248 
249  if (*p == '#') {
250  p++;
251  len--;
252  if (len == 3) {
253  ret |= (hex_char_to_number(p[2]) << 4) |
254  (hex_char_to_number(p[1]) << 12) |
255  (hex_char_to_number(p[0]) << 20);
256  } else if (len == 4) {
257  ret = (hex_char_to_number(p[3]) << 4) |
258  (hex_char_to_number(p[2]) << 12) |
259  (hex_char_to_number(p[1]) << 20) |
260  (hex_char_to_number(p[0]) << 28);
261  } else if (len == 6) {
262  ret |= hex_char_to_number(p[5]) |
263  (hex_char_to_number(p[4]) << 4) |
264  (hex_char_to_number(p[3]) << 8) |
265  (hex_char_to_number(p[2]) << 12) |
266  (hex_char_to_number(p[1]) << 16) |
267  (hex_char_to_number(p[0]) << 20);
268  } else if (len == 8) {
269  ret = hex_char_to_number(p[7]) |
270  (hex_char_to_number(p[6]) << 4) |
271  (hex_char_to_number(p[5]) << 8) |
272  (hex_char_to_number(p[4]) << 12) |
273  (hex_char_to_number(p[3]) << 16) |
274  (hex_char_to_number(p[2]) << 20) |
275  (hex_char_to_number(p[1]) << 24) |
276  (hex_char_to_number(p[0]) << 28);
277  }
278  } else {
279  len = FFMIN(len, sizeof(color_name) - 1);
280  strncpy(color_name, p, len);
281  color_name[len] = '\0';
282 
283  entry = bsearch(color_name,
284  color_table,
286  sizeof(ColorEntry),
288 
289  if (!entry)
290  return ret;
291 
292  ret = entry->rgb_color;
293  }
294  return ret;
295 }
296 
297 static int ascii2index(const uint8_t *cpixel, int cpp)
298 {
299  const uint8_t *p = cpixel;
300  int n = 0, m = 1, i;
301 
302  for (i = 0; i < cpp; i++) {
303  if (*p < MIN_ELEMENT || *p > MAX_ELEMENT)
304  return AVERROR_INVALIDDATA;
305  n += (*p++ - MIN_ELEMENT) * m;
306  m *= NB_ELEMENTS;
307  }
308  return n;
309 }
310 
312  int *got_frame, AVPacket *avpkt)
313 {
314  XPMDecContext *x = avctx->priv_data;
315  const uint8_t *end, *ptr;
316  int ncolors, cpp, ret, i, j;
317  int64_t size;
318  uint32_t *dst;
319  int width, height;
320 
321  avctx->pix_fmt = AV_PIX_FMT_BGRA;
322 
323  av_fast_padded_malloc(&x->buf, &x->buf_size, avpkt->size);
324  if (!x->buf)
325  return AVERROR(ENOMEM);
326  memcpy(x->buf, avpkt->data, avpkt->size);
327  x->buf[avpkt->size] = 0;
328 
329  ptr = x->buf;
330  end = x->buf + avpkt->size;
331  while (end - ptr > 9 && memcmp(ptr, "/* XPM */", 9))
332  ptr++;
333 
334  if (end - ptr <= 9) {
335  av_log(avctx, AV_LOG_ERROR, "missing signature\n");
336  return AVERROR_INVALIDDATA;
337  }
338 
339  ptr += mod_strcspn(ptr, "\"");
340  if (sscanf(ptr, "\"%u %u %u %u\",",
341  &width, &height, &ncolors, &cpp) != 4) {
342  av_log(avctx, AV_LOG_ERROR, "missing image parameters\n");
343  return AVERROR_INVALIDDATA;
344  }
345 
346  if ((ret = ff_set_dimensions(avctx, width, height)) < 0)
347  return ret;
348 
349  if (cpp <= 0 || cpp >= 5) {
350  av_log(avctx, AV_LOG_ERROR, "unsupported/invalid number of chars per pixel: %d\n", cpp);
351  return AVERROR_INVALIDDATA;
352  }
353 
354  size = 1;
355  for (i = 0; i < cpp; i++)
356  size *= NB_ELEMENTS;
357 
358  if (ncolors <= 0 || ncolors > size) {
359  av_log(avctx, AV_LOG_ERROR, "invalid number of colors: %d\n", ncolors);
360  return AVERROR_INVALIDDATA;
361  }
362 
363  if (size > SIZE_MAX / 4)
364  return AVERROR(ENOMEM);
365 
366  size *= 4;
367 
368  ptr += mod_strcspn(ptr, ",") + 1;
369  if (end - ptr < 1)
370  return AVERROR_INVALIDDATA;
371 
372  if (avctx->skip_frame >= AVDISCARD_ALL)
373  return avpkt->size;
374 
375  if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
376  return ret;
377 
378  av_fast_padded_malloc(&x->pixels, &x->pixels_size, size);
379  if (!x->pixels)
380  return AVERROR(ENOMEM);
381 
382  for (i = 0; i < ncolors; i++) {
383  const uint8_t *index;
384  size_t len;
385 
386  ptr += mod_strcspn(ptr, "\"") + 1;
387  if (end - ptr < cpp)
388  return AVERROR_INVALIDDATA;
389  index = ptr;
390  ptr += cpp;
391 
392  ptr = strstr(ptr, "c ");
393  if (ptr) {
394  ptr += 2;
395  } else {
396  return AVERROR_INVALIDDATA;
397  }
398 
399  len = strcspn(ptr, "\" ");
400 
401  if ((ret = ascii2index(index, cpp)) < 0)
402  return ret;
403 
404  x->pixels[ret] = color_string_to_rgba(ptr, len);
405  ptr += mod_strcspn(ptr, ",") + 1;
406  if (end - ptr < 1)
407  return AVERROR_INVALIDDATA;
408  }
409 
410  for (i = 0; i < avctx->height; i++) {
411  dst = (uint32_t *)(p->data[0] + i * p->linesize[0]);
412  if (end - ptr < 1)
413  return AVERROR_INVALIDDATA;
414  ptr += mod_strcspn(ptr, "\"") + 1;
415  if (end - ptr < 1)
416  return AVERROR_INVALIDDATA;
417 
418  for (j = 0; j < avctx->width; j++) {
419  if (end - ptr < cpp)
420  return AVERROR_INVALIDDATA;
421 
422  if ((ret = ascii2index(ptr, cpp)) < 0)
423  return ret;
424 
425  *dst++ = x->pixels[ret];
426  ptr += cpp;
427  }
428  ptr += mod_strcspn(ptr, ",") + 1;
429  }
430 
431  p->flags |= AV_FRAME_FLAG_KEY;
433 
434  *got_frame = 1;
435 
436  return avpkt->size;
437 }
438 
440 {
441  XPMDecContext *x = avctx->priv_data;
442  av_freep(&x->pixels);
443 
444  av_freep(&x->buf);
445  x->buf_size = 0;
446 
447  return 0;
448 }
449 
451  .p.name = "xpm",
452  CODEC_LONG_NAME("XPM (X PixMap) image"),
453  .p.type = AVMEDIA_TYPE_VIDEO,
454  .p.id = AV_CODEC_ID_XPM,
455  .p.capabilities = AV_CODEC_CAP_DR1,
456  .priv_data_size = sizeof(XPMDecContext),
457  .close = xpm_decode_close,
458  .caps_internal = FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM,
460 };
NB_ELEMENTS
#define NB_ELEMENTS
Definition: xpmdec.c:31
name
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 default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
xpm_decode_close
static av_cold int xpm_decode_close(AVCodecContext *avctx)
Definition: xpmdec.c:439
entry
#define entry
Definition: aom_film_grain_template.c:66
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
MIN_ELEMENT
#define MIN_ELEMENT
Definition: xpmdec.c:29
int64_t
long long int64_t
Definition: coverity.c:34
av_strcasecmp
int av_strcasecmp(const char *a, const char *b)
Locale-independent case-insensitive compare.
Definition: avstring.c:207
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:344
AVPacket::data
uint8_t * data
Definition: packet.h:522
FFCodec
Definition: codec_internal.h:127
MAX_ELEMENT
#define MAX_ELEMENT
Definition: xpmdec.c:30
AV_PIX_FMT_BGRA
@ AV_PIX_FMT_BGRA
packed BGRA 8:8:8:8, 32bpp, BGRABGRA...
Definition: pixfmt.h:102
XPMContext::buf_size
int buf_size
Definition: xpmdec.c:37
AVFrame::flags
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
Definition: frame.h:616
cpixel
#define cpixel
Definition: colorchannelmixer_template.c:37
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:94
XPMContext::pixels
uint32_t * pixels
Definition: xpmdec.c:34
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:365
ff_xpm_decoder
const FFCodec ff_xpm_decoder
Definition: xpmdec.c:450
FFCodec::p
AVCodec p
The public AVCodec.
Definition: codec_internal.h:131
AVCodecContext::skip_frame
enum AVDiscard skip_frame
Skip decoding for selected frames.
Definition: avcodec.h:1819
color_table_compare
static int color_table_compare(const void *lhs, const void *rhs)
Definition: xpmdec.c:45
ascii2index
static int ascii2index(const uint8_t *cpixel, int cpp)
Definition: xpmdec.c:297
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:595
XPMContext::buf
uint8_t * buf
Definition: xpmdec.c:36
width
#define width
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
decode.h
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:219
mod_strcspn
static size_t mod_strcspn(const char *string, const char *reject)
Definition: xpmdec.c:217
XPMContext
Definition: xpmdec.c:33
xpm_decode_frame
static int xpm_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
Definition: xpmdec.c:311
AV_PICTURE_TYPE_I
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:279
ColorEntry::rgb_color
uint32_t rgb_color
RGB values for the color.
Definition: xpmdec.c:42
index
int index
Definition: gxfenc.c:89
XPMContext::pixels_size
int pixels_size
Definition: xpmdec.c:35
hex_char_to_number
static unsigned hex_char_to_number(uint8_t x)
Definition: xpmdec.c:194
AVFrame::pict_type
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:446
ff_get_buffer
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1569
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
AVPacket::size
int size
Definition: packet.h:523
codec_internal.h
size
int size
Definition: twinvq_data.h:10344
FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM
The decoder extracts and fills its parameters even if the frame is skipped due to the skip_frame sett...
Definition: codec_internal.h:54
height
#define height
AV_CODEC_ID_XPM
@ AV_CODEC_ID_XPM
Definition: codec_id.h:279
ColorEntry
Definition: xpmdec.c:40
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
TIMES256
#define TIMES256(idx)
av_fast_padded_malloc
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:52
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
AVCodec::name
const char * name
Name of the codec implementation.
Definition: codec.h:194
len
int len
Definition: vorbis_enc_data.h:426
AVCodecContext::height
int height
Definition: avcodec.h:618
AVCodecContext::pix_fmt
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:657
avcodec.h
ret
ret
Definition: filter_design.txt:187
AVCodecContext
main external API structure.
Definition: avcodec.h:445
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:472
AVPacket
This structure stores compressed data.
Definition: packet.h:499
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
AVCodecContext::width
int width
picture width / height.
Definition: avcodec.h:618
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:389
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
avstring.h
color_table
static const ColorEntry color_table[]
Definition: xpmdec.c:50
ColorEntry::name
const char * name
a string representing the name of the color
Definition: xpmdec.c:41
color_string_to_rgba
static uint32_t color_string_to_rgba(const char *p, size_t len)
Definition: xpmdec.c:243