22 #include "libavutil/imgutils.h"
23 #include "libavutil/avassert.h"
47 uint8_t *out_end,
int pixelstride)
50 unsigned char *orig = out_buf;
52 while (out_buf < out_end) {
55 pixel = bytestream2_get_byteu(&s->
g);
56 if (!(count = (pixel & 0x7f))) {
61 if (out_end - out_buf <= pixelstride * (count - 1))
66 *out_buf = bytestream2_get_byte(&s->
g);
67 out_buf += pixelstride;
70 pixel = bytestream2_get_byte(&s->
g);
74 out_buf += pixelstride;
78 return (out_buf - orig) / pixelstride;
93 unsigned int start_offset;
100 for (z = 0; z < s->
depth; z++) {
102 for (y = 0; y < s->
height; y++) {
104 start_offset = bytestream2_get_be32(&g_table);
133 for (z = 0; z < s->
depth; z++) {
138 for (y = s->
height - 1; y >= 0; y--) {
139 out_end = out_buf + (y * s->
linesize);
141 for (x = s->
width; x > 0; x--)
142 for (z = 0; z < s->
depth; z++)
143 *out_end++ = bytestream2_get_byteu(&gp[z]);
145 uint16_t *out16 = (uint16_t *)out_end;
146 for (x = s->
width; x > 0; x--)
147 for (z = 0; z < s->
depth; z++)
155 void *
data,
int *got_frame,
160 unsigned int dimension, rle;
171 if (bytestream2_get_be16u(&s->
g) !=
SGI_MAGIC) {
176 rle = bytestream2_get_byteu(&s->
g);
178 dimension = bytestream2_get_be16u(&s->
g);
179 s->
width = bytestream2_get_be16u(&s->
g);
180 s->
height = bytestream2_get_be16u(&s->
g);
181 s->
depth = bytestream2_get_be16u(&s->
g);
189 if (dimension != 2 && dimension != 3) {
214 out_buf = p->
data[0];
static int expand_rle_row(SgiState *s, uint8_t *out_buf, uint8_t *out_end, int pixelstride)
Expand an RLE row into a channel.
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
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)
static int read_rle_sgi(uint8_t *out_buf, SgiState *s)
Read a run length encoded SGI image.
unsigned int bytes_per_channel
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
static const uint8_t offset[511][2]
const char * name
Name of the codec implementation.
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g)
Libavcodec external API header.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
enum AVPictureType pict_type
Picture type of the frame.
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
static int read_uncompressed_sgi(unsigned char *out_buf, SgiState *s)
Read an uncompressed SGI image.
#define SGI_MAGIC
SGI image file signature.
#define bytestream2_get_ne16u
common internal api header.
#define AVERROR_INVALIDDATA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int key_frame
1 -> keyframe, 0-> not
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static int decode(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.