47 int len,
int pixelstride)
49 unsigned char pixel, count;
50 unsigned char *orig = out_buf;
55 pixel = bytestream2_get_byteu(&s->
g);
56 if (!(count = (pixel & 0x7f))) {
57 return (out_buf - orig) / pixelstride;
61 if (pixelstride * (count - 1) >= len) {
68 *out_buf = bytestream2_get_byte(&s->
g);
69 out_buf += pixelstride;
72 pixel = bytestream2_get_byte(&s->
g);
76 out_buf += pixelstride;
94 unsigned int start_offset;
101 for (z = 0; z < s->
depth; z++) {
103 for (y = 0; y < s->
height; y++) {
105 start_offset = bytestream2_get_be32(&g_table);
135 for (z = 0; z < s->
depth; z++) {
140 for (y = s->
height - 1; y >= 0; y--) {
141 out_end = out_buf + (y * s->
linesize);
143 for (x = s->
width; x > 0; x--)
144 for (z = 0; z < s->
depth; z++)
145 *out_end++ = bytestream2_get_byteu(&gp[z]);
147 uint16_t *out16 = (uint16_t *)out_end;
148 for (x = s->
width; x > 0; x--)
149 for (z = 0; z < s->
depth; z++)
157 void *
data,
int *data_size,
163 unsigned int dimension, rle;
165 uint8_t *out_buf, *out_end;
174 if (bytestream2_get_be16(&s->
g) !=
SGI_MAGIC) {
179 rle = bytestream2_get_byte(&s->
g);
181 dimension = bytestream2_get_be16(&s->
g);
182 s->
width = bytestream2_get_be16(&s->
g);
183 s->
height = bytestream2_get_be16(&s->
g);
184 s->
depth = bytestream2_get_be16(&s->
g);
192 if (dimension != 2 && dimension != 3) {
223 out_buf = p->
data[0];
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
AVFrame * coded_frame
the picture in the bitstream
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
static av_cold int sgi_init(AVCodecContext *avctx)
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
static int init(AVCodecParserContext *s)
static int read_uncompressed_sgi(unsigned char *out_buf, uint8_t *out_end, SgiState *s)
Read an uncompressed SGI image.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
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)
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
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, see ?_TYPE below.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
struct AVPicture AVPicture
four components are given, that's all.
static int expand_rle_row(SgiState *s, uint8_t *out_buf, int len, int pixelstride)
Expand an RLE row into a channel.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define SGI_MAGIC
SGI image file signature.
#define bytestream2_get_ne16u
packed RGB 8:8:8, 24bpp, RGBRGB...
int key_frame
1 -> keyframe, 0-> not
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
static av_cold int sgi_end(AVCodecContext *avctx)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
void avcodec_get_frame_defaults(AVFrame *pic)
Set the fields of the given AVFrame to default values.