78 signature = bytestream2_get_le32(&s->
gb);
79 if (signature !=
MKTAG(
'8',
'B',
'P',
'S')) {
84 version = bytestream2_get_be16(&s->
gb);
98 s->
height = bytestream2_get_be32(&s->
gb);
102 "Height > 30000 is experimental, add " 103 "'-strict %d' if you want to try to decode the picture.\n",
108 s->
width = bytestream2_get_be32(&s->
gb);
111 "Width > 30000 is experimental, add " 112 "'-strict %d' if you want to try to decode the picture.\n",
122 color_mode = bytestream2_get_be16(&s->
gb);
123 switch (color_mode) {
154 len_section = bytestream2_get_be32(&s->
gb);
155 if (len_section < 0) {
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;
175 len_section = bytestream2_get_be32(&s->
gb);
176 if (len_section < 0) {
188 len_section = bytestream2_get_be32(&s->
gb);
189 if (len_section < 0) {
226 unsigned int scanline_count;
227 unsigned int sl,
count;
228 unsigned long target_index = 0;
231 unsigned int repeat_count;
244 for (sl = 0; sl < scanline_count; sl++) {
248 rle_char = bytestream2_get_byte(&s->
gb);
251 repeat_count = rle_char * -1;
263 v = bytestream2_get_byte(&s->
gb);
264 for (p = 0; p <= repeat_count; p++) {
265 s->
tmp[target_index++] = v;
267 count += repeat_count + 1;
279 for (p = 0; p <= rle_char; p++) {
280 v = bytestream2_get_byte(&s->
gb);
281 s->
tmp[target_index++] = v;
283 count += rle_char + 1;
297 int index_out,
c, y, x, p;
298 uint8_t eq_channel[4] = {2,0,1,3};
322 "Invalid bitmap file (channel_depth %d, channel_count %d)\n",
332 "Invalid indexed file (channel_depth %d, channel_count %d)\n",
448 ptr = picture->
data[0];
450 for (y = 0; y < s->
height; y++) {
451 for (x = 0; x < s->
width; x++) {
454 ptr[index_out + p] = *ptr_data;
468 for (y = 0; y < s->
height; y++) {
469 for (x = 0; x < s->
width; x++) {
471 int r = src[0][x] * k;
472 int g = src[1][x] * k;
473 int b = src[2][x] * k;
474 dst[0][x] = g * 257 >> 16;
475 dst[1][x] = b * 257 >> 16;
476 dst[2][x] = r * 257 >> 16;
487 for (y = 0; y < s->
height; y++) {
494 for (y = 0; y < s->
height; y++) {
495 for (x = 0; x < s->
width; x++) {
496 int64_t k =
AV_RB16(&src[3][x * 2]);
497 int64_t
r =
AV_RB16(&src[0][x * 2]) * k;
498 int64_t
g =
AV_RB16(&src[1][x * 2]) * k;
499 int64_t
b =
AV_RB16(&src[2][x * 2]) * k;
500 AV_WB16(&dst[0][x * 2], g * 65537 >> 32);
501 AV_WB16(&dst[1][x * 2], b * 65537 >> 32);
502 AV_WB16(&dst[2][x * 2], r * 65537 >> 32);
513 for (y = 0; y < s->
height; y++) {
525 plane_number = eq_channel[
c];
526 ptr = picture->
data[plane_number];
527 for (y = 0; y < s->
height; y++) {
529 ptr += picture->
linesize[plane_number];
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
IEEE-754 single precision Y, 32bpp, big-endian.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
8 bits gray, 8 bits alpha
#define AV_LOG_WARNING
Something somehow does not look correct.
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.
static int decode_rle(PSDContext *s)
#define avpriv_request_sample(...)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
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
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
planar GBRA 4:4:4:4 64bpp, big-endian
static const char signature[]
8 bits with AV_PIX_FMT_RGB32 palette
static int decode_header(PSDContext *s)
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
planar GBR 4:4:4 48bpp, big-endian
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum PsdCompr compression
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
16 bits gray, 16 bits alpha (big-endian)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
uint64_t uncompressed_size
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
#define AV_CODEC_CAP_FRAME_THREADS
Codec supports frame-level multithreading.
enum AVPictureType pict_type
Picture type of the frame.
enum PsdColorMode color_mode
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it...
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
uint8_t palette[AVPALETTE_SIZE]
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Describe the class of an AVClass context structure.
int palette_has_changed
Tell user application that palette has changed from previous frame.
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.
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
planar GBRA 4:4:4:4 32bpp
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
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
#define MKTAG(a, b, c, d)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
int strict_std_compliance
strictly follow the standard (MPEG-4, ...).