Go to the documentation of this file.
39 unsigned char pixel, count;
40 unsigned char *orig = out_buf;
41 uint8_t *out_end = out_buf +
width;
43 while (out_buf < out_end) {
46 pixel = bytestream2_get_byteu(
g);
47 if (!(count = (
pixel & 0x7f))) {
52 if (out_end - out_buf < count) {
59 *out_buf++ = bytestream2_get_byte(
g);
61 pixel = bytestream2_get_byte(
g);
67 return out_buf - orig;
75 unsigned short *orig = out_buf;
76 uint16_t *out_end = out_buf +
width;
78 while (out_buf < out_end) {
81 pixel = bytestream2_get_be16u(
g);
82 if (!(count = (
pixel & 0x7f)))
86 if (out_end - out_buf < count) {
106 return out_buf - orig;
118 unsigned nb_components,
unsigned bytes_per_channel)
120 unsigned int len =
height * nb_components * 4;
122 unsigned int start_offset;
130 for (
unsigned z = 0; z < nb_components; z++) {
133 start_offset = bytestream2_get_be32(&g_table);
135 if (bytes_per_channel == 1)
141 if (dest_row ==
out[z])
157 unsigned nb_components,
unsigned bytes_per_channel)
159 unsigned rowsize =
width * bytes_per_channel;
165 for (
unsigned z = 0; z < nb_components; z++) {
169 if (cur_row ==
out[z])
183 ptrdiff_t linesize[4];
199 rle = bytestream2_get_byteu(&
g);
200 bytes_per_channel = bytestream2_get_byteu(&
g);
202 width = bytestream2_get_be16u(&
g);
203 height = bytestream2_get_be16u(&
g);
204 nb_components = bytestream2_get_be16u(&
g);
206 if (bytes_per_channel != 1 && bytes_per_channel != 2) {
219 }
else if (nb_components ==
SGI_RGB) {
221 }
else if (nb_components ==
SGI_RGBA) {
235 switch (nb_components) {
236 #define MAP(in_idx, out_idx) \
237 out[(in_idx)] = p->data[(out_idx)]; \
238 linesize[(in_idx)] = p->linesize[(out_idx)]
@ AV_PIX_FMT_GBRP16BE
planar GBR 4:4:4 48bpp, big-endian
This structure describes decoded (raw) audio or video data.
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static int read_rle_sgi(void *logctx, uint8_t *out[4], ptrdiff_t stride[4], GetByteContext *g, unsigned width, int height, unsigned nb_components, unsigned bytes_per_channel)
Read a run length encoded SGI image.
static int expand_rle_row8(void *logctx, uint8_t *out_buf, GetByteContext *g, unsigned width)
Expand an RLE row into a channel.
int flags
Frame flags, a combination of AV_FRAME_FLAGS.
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 rle(uint8_t *dst, const uint8_t *src, int compressed_size, int uncompressed_size)
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
AVCodec p
The public AVCodec.
@ AV_PIX_FMT_GBRAP
planar GBRA 4:4:4:4 32bpp
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
@ AV_PIX_FMT_GBRAP16BE
planar GBRA 4:4:4:4 64bpp, big-endian
#define FF_CODEC_DECODE_CB(func)
const FFCodec ff_sgi_decoder
#define SGI_MAGIC
SGI image file signature.
#define CODEC_LONG_NAME(str)
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
enum AVPictureType pict_type
Picture type of the frame.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define bytestream2_get_ne16
static int expand_rle_row16(void *logctx, uint16_t *out_buf, GetByteContext *g, unsigned width)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
main external API structure.
#define MAP(in_idx, out_idx)
@ AV_PIX_FMT_GBRP
planar GBR 4:4:4 24bpp
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
This structure stores compressed data.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
The official guide to swscale for confused that consecutive non overlapping rectangles of dimension(0, slice_top) -(picture_width
static int decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
static int read_uncompressed_sgi(uint8_t *const out[4], const ptrdiff_t stride[4], GetByteContext *g, unsigned width, int height, unsigned nb_components, unsigned bytes_per_channel)
Read an uncompressed SGI image.