FFmpeg  4.2.2
psd.c
Go to the documentation of this file.
1 /*
2  * Photoshop (PSD) image decoder
3  * Copyright (c) 2016 Jokyo Images
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 "bytestream.h"
23 #include "internal.h"
24 
25 enum PsdCompr {
30 };
31 
41 };
42 
43 typedef struct PSDContext {
44  AVClass *class;
48 
50 
51  uint16_t channel_count;
52  uint16_t channel_depth;
53 
55  unsigned int pixel_size;/* 1 for 8 bits, 2 for 16 bits */
56  uint64_t line_size;/* length of src data (even width) */
57 
58  int width;
59  int height;
60 
63 
65 } PSDContext;
66 
67 static int decode_header(PSDContext * s)
68 {
70  int64_t len_section;
71  int ret = 0;
72 
73  if (bytestream2_get_bytes_left(&s->gb) < 30) {/* File header section + color map data section length */
74  av_log(s->avctx, AV_LOG_ERROR, "Header too short to parse.\n");
75  return AVERROR_INVALIDDATA;
76  }
77 
78  signature = bytestream2_get_le32(&s->gb);
79  if (signature != MKTAG('8','B','P','S')) {
80  av_log(s->avctx, AV_LOG_ERROR, "Wrong signature %d.\n", signature);
81  return AVERROR_INVALIDDATA;
82  }
83 
84  version = bytestream2_get_be16(&s->gb);
85  if (version != 1) {
86  av_log(s->avctx, AV_LOG_ERROR, "Wrong version %d.\n", version);
87  return AVERROR_INVALIDDATA;
88  }
89 
90  bytestream2_skip(&s->gb, 6);/* reserved */
91 
92  s->channel_count = bytestream2_get_be16(&s->gb);
93  if ((s->channel_count < 1) || (s->channel_count > 56)) {
94  av_log(s->avctx, AV_LOG_ERROR, "Invalid channel count %d.\n", s->channel_count);
95  return AVERROR_INVALIDDATA;
96  }
97 
98  s->height = bytestream2_get_be32(&s->gb);
99 
100  if ((s->height > 30000) && (s->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)) {
102  "Height > 30000 is experimental, add "
103  "'-strict %d' if you want to try to decode the picture.\n",
105  return AVERROR_EXPERIMENTAL;
106  }
107 
108  s->width = bytestream2_get_be32(&s->gb);
109  if ((s->width > 30000) && (s->avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)) {
111  "Width > 30000 is experimental, add "
112  "'-strict %d' if you want to try to decode the picture.\n",
114  return AVERROR_EXPERIMENTAL;
115  }
116 
117  if ((ret = ff_set_dimensions(s->avctx, s->width, s->height)) < 0)
118  return ret;
119 
120  s->channel_depth = bytestream2_get_be16(&s->gb);
121 
122  color_mode = bytestream2_get_be16(&s->gb);
123  switch (color_mode) {
124  case 0:
125  s->color_mode = PSD_BITMAP;
126  break;
127  case 1:
129  break;
130  case 2:
131  s->color_mode = PSD_INDEXED;
132  break;
133  case 3:
134  s->color_mode = PSD_RGB;
135  break;
136  case 4:
137  s->color_mode = PSD_CMYK;
138  break;
139  case 7:
141  break;
142  case 8:
143  s->color_mode = PSD_DUOTONE;
144  break;
145  case 9:
146  s->color_mode = PSD_LAB;
147  break;
148  default:
149  av_log(s->avctx, AV_LOG_ERROR, "Unknown color mode %d.\n", color_mode);
150  return AVERROR_INVALIDDATA;
151  }
152 
153  /* color map data */
154  len_section = bytestream2_get_be32(&s->gb);
155  if (len_section < 0) {
156  av_log(s->avctx, AV_LOG_ERROR, "Negative size for color map data section.\n");
157  return AVERROR_INVALIDDATA;
158  }
159 
160  if (bytestream2_get_bytes_left(&s->gb) < (len_section + 4)) { /* section and len next section */
161  av_log(s->avctx, AV_LOG_ERROR, "Incomplete file.\n");
162  return AVERROR_INVALIDDATA;
163  }
164  if (len_section) {
165  int i,j;
166  memset(s->palette, 0xff, AVPALETTE_SIZE);
167  for (j = HAVE_BIGENDIAN; j < 3 + HAVE_BIGENDIAN; j++)
168  for (i = 0; i < FFMIN(256, len_section / 3); i++)
169  s->palette[i * 4 + (HAVE_BIGENDIAN ? j : 2 - j)] = bytestream2_get_byteu(&s->gb);
170  len_section -= i * 3;
171  }
172  bytestream2_skip(&s->gb, len_section);
173 
174  /* image ressources */
175  len_section = bytestream2_get_be32(&s->gb);
176  if (len_section < 0) {
177  av_log(s->avctx, AV_LOG_ERROR, "Negative size for image ressources section.\n");
178  return AVERROR_INVALIDDATA;
179  }
180 
181  if (bytestream2_get_bytes_left(&s->gb) < (len_section + 4)) { /* section and len next section */
182  av_log(s->avctx, AV_LOG_ERROR, "Incomplete file.\n");
183  return AVERROR_INVALIDDATA;
184  }
185  bytestream2_skip(&s->gb, len_section);
186 
187  /* layers and masks */
188  len_section = bytestream2_get_be32(&s->gb);
189  if (len_section < 0) {
190  av_log(s->avctx, AV_LOG_ERROR, "Negative size for layers and masks data section.\n");
191  return AVERROR_INVALIDDATA;
192  }
193 
194  if (bytestream2_get_bytes_left(&s->gb) < len_section) {
195  av_log(s->avctx, AV_LOG_ERROR, "Incomplete file.\n");
196  return AVERROR_INVALIDDATA;
197  }
198  bytestream2_skip(&s->gb, len_section);
199 
200  /* image section */
201  if (bytestream2_get_bytes_left(&s->gb) < 2) {
202  av_log(s->avctx, AV_LOG_ERROR, "File without image data section.\n");
203  return AVERROR_INVALIDDATA;
204  }
205 
206  s->compression = bytestream2_get_be16(&s->gb);
207  switch (s->compression) {
208  case 0:
209  case 1:
210  break;
211  case 2:
212  avpriv_request_sample(s->avctx, "ZIP without predictor compression");
213  return AVERROR_PATCHWELCOME;
214  break;
215  case 3:
216  avpriv_request_sample(s->avctx, "ZIP with predictor compression");
217  return AVERROR_PATCHWELCOME;
218  break;
219  default:
220  av_log(s->avctx, AV_LOG_ERROR, "Unknown compression %d.\n", s->compression);
221  return AVERROR_INVALIDDATA;
222  }
223 
224  return ret;
225 }
226 
227 static int decode_rle(PSDContext * s){
228  unsigned int scanline_count;
229  unsigned int sl, count;
230  unsigned long target_index = 0;
231  unsigned int p;
232  int8_t rle_char;
233  unsigned int repeat_count;
234  uint8_t v;
235 
236  scanline_count = s->height * s->channel_count;
237 
238  /* scanline table */
239  if (bytestream2_get_bytes_left(&s->gb) < scanline_count * 2) {
240  av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline table.\n");
241  return AVERROR_INVALIDDATA;
242  }
243  bytestream2_skip(&s->gb, scanline_count * 2);/* size of each scanline */
244 
245  /* decode rle data scanline by scanline */
246  for (sl = 0; sl < scanline_count; sl++) {
247  count = 0;
248 
249  while (count < s->line_size) {
250  rle_char = bytestream2_get_byte(&s->gb);
251 
252  if (rle_char <= 0) {/* byte repeat */
253  repeat_count = rle_char * -1;
254 
255  if (bytestream2_get_bytes_left(&s->gb) < 1) {
256  av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
257  return AVERROR_INVALIDDATA;
258  }
259 
260  if (target_index + repeat_count >= s->uncompressed_size) {
261  av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
262  return AVERROR_INVALIDDATA;
263  }
264 
265  v = bytestream2_get_byte(&s->gb);
266  for (p = 0; p <= repeat_count; p++) {
267  s->tmp[target_index++] = v;
268  }
269  count += repeat_count + 1;
270  } else {
271  if (bytestream2_get_bytes_left(&s->gb) < rle_char) {
272  av_log(s->avctx, AV_LOG_ERROR, "Not enough data for rle scanline.\n");
273  return AVERROR_INVALIDDATA;
274  }
275 
276  if (target_index + rle_char >= s->uncompressed_size) {
277  av_log(s->avctx, AV_LOG_ERROR, "Invalid rle char.\n");
278  return AVERROR_INVALIDDATA;
279  }
280 
281  for (p = 0; p <= rle_char; p++) {
282  v = bytestream2_get_byte(&s->gb);
283  s->tmp[target_index++] = v;
284  }
285  count += rle_char + 1;
286  }
287  }
288  }
289 
290  return 0;
291 }
292 
294  int *got_frame, AVPacket *avpkt)
295 {
296  int ret;
297  uint8_t *ptr;
298  const uint8_t *ptr_data;
299  int index_out, c, y, x, p;
300  uint8_t eq_channel[4] = {2,0,1,3};/* RGBA -> GBRA channel order */
301  uint8_t plane_number;
302 
303  AVFrame *picture = data;
304 
305  PSDContext *s = avctx->priv_data;
306  s->avctx = avctx;
307  s->channel_count = 0;
308  s->channel_depth = 0;
309  s->tmp = NULL;
310  s->line_size = 0;
311 
312  bytestream2_init(&s->gb, avpkt->data, avpkt->size);
313 
314  if ((ret = decode_header(s)) < 0)
315  return ret;
316 
317  s->pixel_size = s->channel_depth >> 3;/* in byte */
318  s->line_size = s->width * s->pixel_size;
319 
320  switch (s->color_mode) {
321  case PSD_BITMAP:
322  if (s->channel_depth != 1 || s->channel_count != 1) {
324  "Invalid bitmap file (channel_depth %d, channel_count %d)\n",
326  return AVERROR_INVALIDDATA;
327  }
328  s->line_size = s->width + 7 >> 3;
329  avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
330  break;
331  case PSD_INDEXED:
332  if (s->channel_depth != 8 || s->channel_count != 1) {
334  "Invalid indexed file (channel_depth %d, channel_count %d)\n",
336  return AVERROR_INVALIDDATA;
337  }
338  avctx->pix_fmt = AV_PIX_FMT_PAL8;
339  break;
340  case PSD_CMYK:
341  if (s->channel_count == 4) {
342  if (s->channel_depth == 8) {
343  avctx->pix_fmt = AV_PIX_FMT_GBRP;
344  } else if (s->channel_depth == 16) {
345  avctx->pix_fmt = AV_PIX_FMT_GBRP16BE;
346  } else {
347  avpriv_report_missing_feature(avctx, "channel depth %d for cmyk", s->channel_depth);
348  return AVERROR_PATCHWELCOME;
349  }
350  } else if (s->channel_count == 5) {
351  if (s->channel_depth == 8) {
352  avctx->pix_fmt = AV_PIX_FMT_GBRAP;
353  } else if (s->channel_depth == 16) {
354  avctx->pix_fmt = AV_PIX_FMT_GBRAP16BE;
355  } else {
356  avpriv_report_missing_feature(avctx, "channel depth %d for cmyk", s->channel_depth);
357  return AVERROR_PATCHWELCOME;
358  }
359  } else {
360  avpriv_report_missing_feature(avctx, "channel count %d for cmyk", s->channel_count);
361  return AVERROR_PATCHWELCOME;
362  }
363  break;
364  case PSD_RGB:
365  if (s->channel_count == 3) {
366  if (s->channel_depth == 8) {
367  avctx->pix_fmt = AV_PIX_FMT_GBRP;
368  } else if (s->channel_depth == 16) {
369  avctx->pix_fmt = AV_PIX_FMT_GBRP16BE;
370  } else {
371  avpriv_report_missing_feature(avctx, "channel depth %d for rgb", s->channel_depth);
372  return AVERROR_PATCHWELCOME;
373  }
374  } else if (s->channel_count == 4) {
375  if (s->channel_depth == 8) {
376  avctx->pix_fmt = AV_PIX_FMT_GBRAP;
377  } else if (s->channel_depth == 16) {
378  avctx->pix_fmt = AV_PIX_FMT_GBRAP16BE;
379  } else {
380  avpriv_report_missing_feature(avctx, "channel depth %d for rgb", s->channel_depth);
381  return AVERROR_PATCHWELCOME;
382  }
383  } else {
384  avpriv_report_missing_feature(avctx, "channel count %d for rgb", s->channel_count);
385  return AVERROR_PATCHWELCOME;
386  }
387  break;
388  case PSD_DUOTONE:
389  av_log(avctx, AV_LOG_WARNING, "ignoring unknown duotone specification.\n");
390  case PSD_GRAYSCALE:
391  if (s->channel_count == 1) {
392  if (s->channel_depth == 8) {
393  avctx->pix_fmt = AV_PIX_FMT_GRAY8;
394  } else if (s->channel_depth == 16) {
395  avctx->pix_fmt = AV_PIX_FMT_GRAY16BE;
396  } else if (s->channel_depth == 32) {
397  avctx->pix_fmt = AV_PIX_FMT_GRAYF32BE;
398  } else {
399  avpriv_report_missing_feature(avctx, "channel depth %d for grayscale", s->channel_depth);
400  return AVERROR_PATCHWELCOME;
401  }
402  } else if (s->channel_count == 2) {
403  if (s->channel_depth == 8) {
404  avctx->pix_fmt = AV_PIX_FMT_YA8;
405  } else if (s->channel_depth == 16) {
406  avctx->pix_fmt = AV_PIX_FMT_YA16BE;
407  } else {
408  avpriv_report_missing_feature(avctx, "channel depth %d for grayscale", s->channel_depth);
409  return AVERROR_PATCHWELCOME;
410  }
411  } else {
412  avpriv_report_missing_feature(avctx, "channel count %d for grayscale", s->channel_count);
413  return AVERROR_PATCHWELCOME;
414  }
415  break;
416  default:
417  avpriv_report_missing_feature(avctx, "color mode %d", s->color_mode);
418  return AVERROR_PATCHWELCOME;
419  }
420 
422 
423  if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
424  return ret;
425 
426  /* decode picture if need */
427  if (s->compression == PSD_RLE) {
429  if (!s->tmp)
430  return AVERROR(ENOMEM);
431 
432  ret = decode_rle(s);
433 
434  if (ret < 0) {
435  av_freep(&s->tmp);
436  return ret;
437  }
438 
439  ptr_data = s->tmp;
440  } else {
442  av_log(s->avctx, AV_LOG_ERROR, "Not enough data for raw image data section.\n");
443  return AVERROR_INVALIDDATA;
444  }
445  ptr_data = s->gb.buffer;
446  }
447 
448  /* Store data */
449  if ((avctx->pix_fmt == AV_PIX_FMT_YA8)||(avctx->pix_fmt == AV_PIX_FMT_YA16BE)){/* Interleaved */
450  ptr = picture->data[0];
451  for (c = 0; c < s->channel_count; c++) {
452  for (y = 0; y < s->height; y++) {
453  for (x = 0; x < s->width; x++) {
454  index_out = y * picture->linesize[0] + x * s->channel_count * s->pixel_size + c * s->pixel_size;
455  for (p = 0; p < s->pixel_size; p++) {
456  ptr[index_out + p] = *ptr_data;
457  ptr_data ++;
458  }
459  }
460  }
461  }
462  } else if (s->color_mode == PSD_CMYK) {
463  uint8_t *dst[4] = { picture->data[0], picture->data[1], picture->data[2], picture->data[3] };
464  const uint8_t *src[5] = { ptr_data };
465  src[1] = src[0] + s->line_size * s->height;
466  src[2] = src[1] + s->line_size * s->height;
467  src[3] = src[2] + s->line_size * s->height;
468  src[4] = src[3] + s->line_size * s->height;
469  if (s->channel_depth == 8) {
470  for (y = 0; y < s->height; y++) {
471  for (x = 0; x < s->width; x++) {
472  int k = src[3][x];
473  int r = src[0][x] * k;
474  int g = src[1][x] * k;
475  int b = src[2][x] * k;
476  dst[0][x] = g * 257 >> 16;
477  dst[1][x] = b * 257 >> 16;
478  dst[2][x] = r * 257 >> 16;
479  }
480  dst[0] += picture->linesize[0];
481  dst[1] += picture->linesize[1];
482  dst[2] += picture->linesize[2];
483  src[0] += s->line_size;
484  src[1] += s->line_size;
485  src[2] += s->line_size;
486  src[3] += s->line_size;
487  }
488  if (avctx->pix_fmt == AV_PIX_FMT_GBRAP) {
489  for (y = 0; y < s->height; y++) {
490  memcpy(dst[3], src[4], s->line_size);
491  src[4] += s->line_size;
492  dst[3] += picture->linesize[3];
493  }
494  }
495  } else {
496  for (y = 0; y < s->height; y++) {
497  for (x = 0; x < s->width; x++) {
498  int64_t k = AV_RB16(&src[3][x * 2]);
499  int64_t r = AV_RB16(&src[0][x * 2]) * k;
500  int64_t g = AV_RB16(&src[1][x * 2]) * k;
501  int64_t b = AV_RB16(&src[2][x * 2]) * k;
502  AV_WB16(&dst[0][x * 2], g * 65537 >> 32);
503  AV_WB16(&dst[1][x * 2], b * 65537 >> 32);
504  AV_WB16(&dst[2][x * 2], r * 65537 >> 32);
505  }
506  dst[0] += picture->linesize[0];
507  dst[1] += picture->linesize[1];
508  dst[2] += picture->linesize[2];
509  src[0] += s->line_size;
510  src[1] += s->line_size;
511  src[2] += s->line_size;
512  src[3] += s->line_size;
513  }
514  if (avctx->pix_fmt == AV_PIX_FMT_GBRAP16BE) {
515  for (y = 0; y < s->height; y++) {
516  memcpy(dst[3], src[4], s->line_size);
517  src[4] += s->line_size;
518  dst[3] += picture->linesize[3];
519  }
520  }
521  }
522  } else {/* Planar */
523  if (s->channel_count == 1)/* gray 8 or gray 16be */
524  eq_channel[0] = 0;/* assign first channel, to first plane */
525 
526  for (c = 0; c < s->channel_count; c++) {
527  plane_number = eq_channel[c];
528  ptr = picture->data[plane_number];/* get the right plane */
529  for (y = 0; y < s->height; y++) {
530  memcpy(ptr, ptr_data, s->line_size);
531  ptr += picture->linesize[plane_number];
532  ptr_data += s->line_size;
533  }
534  }
535  }
536 
537  if (s->color_mode == PSD_INDEXED) {
538  picture->palette_has_changed = 1;
539  memcpy(picture->data[1], s->palette, AVPALETTE_SIZE);
540  }
541 
542  av_freep(&s->tmp);
543 
544  picture->pict_type = AV_PICTURE_TYPE_I;
545  *got_frame = 1;
546 
547  return avpkt->size;
548 }
549 
551  .name = "psd",
552  .long_name = NULL_IF_CONFIG_SMALL("Photoshop PSD file"),
553  .type = AVMEDIA_TYPE_VIDEO,
554  .id = AV_CODEC_ID_PSD,
555  .priv_data_size = sizeof(PSDContext),
556  .decode = decode_frame,
558 };
Definition: psd.c:33
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: avcodec.h:2633
IEEE-754 single precision Y, 32bpp, big-endian.
Definition: pixfmt.h:340
#define NULL
Definition: coverity.c:32
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
This structure describes decoded (raw) audio or video data.
Definition: frame.h:295
8 bits gray, 8 bits alpha
Definition: pixfmt.h:143
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:182
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
uint16_t channel_count
Definition: psd.c:51
const char * g
Definition: vf_curves.c:115
static int decode_rle(PSDContext *s)
Definition: psd.c:227
uint16_t channel_depth
Definition: psd.c:52
#define avpriv_request_sample(...)
planar GBR 4:4:4 24bpp
Definition: pixfmt.h:168
int size
Definition: avcodec.h:1478
Definition: psd.c:37
const char * b
Definition: vf_curves.c:116
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:1775
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:133
int version
Definition: avisynth_c.h:858
#define src
Definition: vp8dsp.c:254
AVCodec.
Definition: avcodec.h:3481
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:42
uint64_t line_size
Definition: psd.c:56
Definition: psd.c:27
planar GBRA 4:4:4:4 64bpp, big-endian
Definition: pixfmt.h:216
static const char signature[]
Definition: ipmovie.c:615
uint8_t
#define av_malloc(s)
GetByteContext gb
Definition: psd.c:47
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
static int decode_header(PSDContext *s)
Definition: psd.c:67
#define AVPALETTE_SIZE
Definition: pixfmt.h:32
Definition: psd.c:26
PsdCompr
Definition: psd.c:25
const char data[16]
Definition: mxf.c:91
uint8_t * data
Definition: avcodec.h:1477
planar GBR 4:4:4 48bpp, big-endian
Definition: pixfmt.h:174
const uint8_t * buffer
Definition: bytestream.h:34
#define AV_WB16(p, v)
Definition: intreadwrite.h:405
AVFrame * picture
Definition: psd.c:45
#define av_log(a,...)
enum PsdCompr compression
Definition: psd.c:61
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:259
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
16 bits gray, 16 bits alpha (big-endian)
Definition: pixfmt.h:212
PsdColorMode
Definition: psd.c:32
#define AV_RB16
Definition: intreadwrite.h:53
#define AVERROR(e)
Definition: error.h:43
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:164
uint64_t uncompressed_size
Definition: psd.c:54
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
const char * r
Definition: vf_curves.c:114
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:154
const char * name
Name of the codec implementation.
Definition: avcodec.h:3488
AVCodec ff_psd_decoder
Definition: psd.c:550
Definition: psd.c:43
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
Definition: avcodec.h:1037
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:378
#define FFMIN(a, b)
Definition: common.h:96
enum PsdColorMode color_mode
Definition: psd.c:62
#define s(width, name)
Definition: cbs_vp9.c:257
unsigned int pixel_size
Definition: psd.c:55
Definition: psd.c:36
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it...
Definition: error.h:72
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:62
AVCodecContext * avctx
Definition: psd.c:46
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:326
uint8_t palette[AVPALETTE_SIZE]
Definition: psd.c:64
main external API structure.
Definition: avcodec.h:1565
int height
Definition: psd.c:59
uint8_t * tmp
Definition: psd.c:49
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1964
Describe the class of an AVClass context structure.
Definition: log.h:67
Y , 16bpp, big-endian.
Definition: pixfmt.h:97
int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:452
int width
Definition: psd.c:58
void avpriv_report_missing_feature(void *avc, const char *msg,...) av_printf_format(2
Log a generic warning message about a missing feature.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:309
Y , 8bpp.
Definition: pixfmt.h:74
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
Definition: pixfmt.h:75
planar GBRA 4:4:4:4 32bpp
Definition: pixfmt.h:215
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: psd.c:293
static double c[64]
void * priv_data
Definition: avcodec.h:1592
Definition: psd.c:40
#define av_freep(p)
void INT64 INT64 count
Definition: avisynth_c.h:766
#define HAVE_BIGENDIAN
Definition: config.h:199
#define MKTAG(a, b, c, d)
Definition: common.h:366
This structure stores compressed data.
Definition: avcodec.h:1454
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Definition: avcodec.h:981
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).
Definition: avcodec.h:2628