48                            int len, 
int pixelstride)
    51     unsigned char *orig = out_buf;
    54     while (out_buf < out_end) {
    57         pixel = bytestream2_get_byteu(&s->
g);
    58         if (!(count = (pixel & 0x7f))) {
    63         if (out_end - out_buf <= pixelstride * (count - 1)) {
    70                 *out_buf = bytestream2_get_byte(&s->
g);
    71                 out_buf += pixelstride;
    74             pixel = bytestream2_get_byte(&s->
g);
    78                 out_buf += pixelstride;
    82     return (out_buf - orig) / pixelstride;
    86                             int len, 
int pixelstride)
    90     unsigned short *orig = out_buf;
    91     uint16_t *out_end = out_buf + 
len;
    93     while (out_buf < out_end) {
    96         pixel = bytestream2_get_be16u(&s->
g);
    97         if (!(count = (pixel & 0x7f)))
   101         if (out_end - out_buf <= pixelstride * (count - 1)) {
   110                 out_buf += pixelstride;
   117                 out_buf += pixelstride;
   121     return (out_buf - orig) / pixelstride;
   137     unsigned int start_offset;
   145     for (z = 0; z < s->
depth; z++) {
   147         for (y = 0; y < s->
height; y++) {
   150             start_offset = bytestream2_get_be32(&g_table);
   181     for (z = 0; z < s->
depth; z++) {
   186     for (y = s->
height - 1; y >= 0; y--) {
   187         out_end = out_buf + (y * s->
linesize);
   189             for (x = s->
width; x > 0; x--)
   190                 for (z = 0; z < s->
depth; z++)
   191                     *out_end++ = bytestream2_get_byteu(&gp[z]);
   193             uint16_t *out16 = (uint16_t *)out_end;
   194             for (x = s->
width; x > 0; x--)
   195                 for (z = 0; z < s->
depth; z++)
   203                         void *
data, 
int *got_frame,
   208     unsigned int dimension, rle;
   219     if (bytestream2_get_be16u(&s->
g) != 
SGI_MAGIC) {
   224     rle                  = bytestream2_get_byteu(&s->
g);
   226     dimension            = bytestream2_get_be16u(&s->
g);
   227     s->
width             = bytestream2_get_be16u(&s->
g);
   228     s->
height            = bytestream2_get_be16u(&s->
g);
   229     s->
depth             = bytestream2_get_be16u(&s->
g);
   237     if (dimension != 2 && dimension != 3) {
   262     out_buf = p->
data[0];
 
static int expand_rle_row16(SgiState *s, uint16_t *out_buf, int len, int pixelstride)
#define AVERROR_INVALIDDATA
Invalid data found when processing input. 
This structure describes decoded (raw) audio or video data. 
packed RGB 8:8:8, 24bpp, RGBRGB... 
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 av_cold int init(AVCodecContext *avctx)
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. 
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
unsigned int bytes_per_channel
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
#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 bytestream2_get_ne16
#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)
simple assert() macros that are a bit more flexible than ISO C assert(). 
const char * name
Name of the codec implementation. 
static const uint8_t offset[127][2]
packed RGBA 8:8:8:8, 32bpp, RGBARGBA... 
enum AVPictureType pict_type
Picture type of the frame. 
static int expand_rle_row8(SgiState *s, uint8_t *out_buf, int len, int pixelstride)
Expand an RLE row into a channel. 
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Libavcodec external API header. 
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line. 
main external API structure. 
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame. 
static av_cold int sgi_decode_init(AVCodecContext *avctx)
static int read_uncompressed_sgi(unsigned char *out_buf, SgiState *s)
Read an uncompressed SGI image. 
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes. 
#define SGI_MAGIC
SGI image file signature. 
#define bytestream2_get_ne16u
common internal api header. 
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
int key_frame
1 -> keyframe, 0-> not 
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
This structure stores compressed data. 
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.