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