Go to the documentation of this file.
40 unsigned char pixel, count;
41 unsigned char *orig = out_buf;
42 uint8_t *out_end = out_buf +
width;
44 while (out_buf < out_end) {
47 pixel = bytestream2_get_byteu(
g);
48 if (!(count = (
pixel & 0x7f))) {
53 if (out_end - out_buf < count) {
60 *out_buf++ = bytestream2_get_byte(
g);
62 pixel = bytestream2_get_byte(
g);
68 return out_buf - orig;
76 unsigned short *orig = out_buf;
77 uint16_t *out_end = out_buf +
width;
79 while (out_buf < out_end) {
82 pixel = bytestream2_get_be16u(
g);
83 if (!(count = (
pixel & 0x7f)))
87 if (out_end - out_buf < count) {
107 return out_buf - orig;
119 unsigned nb_components,
unsigned bytes_per_channel)
121 unsigned int len =
height * nb_components * 4;
123 unsigned int start_offset;
131 for (
unsigned z = 0; z < nb_components; z++) {
134 start_offset = bytestream2_get_be32(&g_table);
136 if (bytes_per_channel == 1)
142 if (dest_row ==
out[z])
158 unsigned nb_components,
unsigned bytes_per_channel)
160 unsigned rowsize =
width * bytes_per_channel;
166 for (
unsigned z = 0; z < nb_components; z++) {
170 if (cur_row ==
out[z])
184 ptrdiff_t linesize[4];
200 rle = bytestream2_get_byteu(&
g);
201 bytes_per_channel = bytestream2_get_byteu(&
g);
203 width = bytestream2_get_be16u(&
g);
204 height = bytestream2_get_be16u(&
g);
205 nb_components = bytestream2_get_be16u(&
g);
207 if (bytes_per_channel != 1 && bytes_per_channel != 2) {
220 }
else if (nb_components ==
SGI_RGB) {
222 }
else if (nb_components ==
SGI_RGBA) {
236 switch (nb_components) {
237 #define MAP(in_idx, out_idx) \
238 out[(in_idx)] = p->data[(out_idx)]; \
239 linesize[(in_idx)] = p->linesize[(out_idx)]
static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g)
@ 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 ff_set_dimensions(AVCodecContext *s, int width, int height)
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.
@ 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_PIX_FMT_GRAY8
Y , 8bpp.
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.
IDirect3DDxgiInterfaceAccess _COM_Outptr_ void ** p
#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.