28 #define SGI_SINGLE_CHAN 2
29 #define SGI_MULTI_CHAN 3
46 const AVFrame *frame,
int *got_packet)
50 uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *buf;
51 int x, y, z, length, tablesize, ret;
53 unsigned char *end_buf;
79 tablesize = depth * height * 4;
82 length += depth * height *
width;
84 length += tablesize * 2 + depth * height * (2 * width + 1);
96 bytestream_put_byte(&buf, 1);
97 bytestream_put_be16(&buf, dimension);
98 bytestream_put_be16(&buf, width);
99 bytestream_put_be16(&buf, height);
100 bytestream_put_be16(&buf, depth);
103 bytestream_put_be32(&buf, 0
L);
104 bytestream_put_be32(&buf, 255
L);
105 bytestream_put_be32(&buf, 0
L);
112 bytestream_put_be32(&buf, 0
L);
130 for (z = 0; z < depth; z++) {
131 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z;
133 for (y = 0; y <
height; y++) {
134 bytestream_put_be32(&offsettab, buf - pkt->
data);
136 for (x = 0; x <
width; x++)
137 encode_buf[x] = in_buf[depth * x];
139 if ((length =
ff_rle_encode(buf, end_buf - buf - 1, encode_buf, 1, width, 0, 0, 0x80, 0)) < 1) {
145 bytestream_put_byte(&buf, 0);
146 bytestream_put_be32(&lengthtab, length + 1);
153 for (z = 0; z < depth; z++) {
154 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z;
156 for (y = 0; y <
height; y++) {
157 for (x = 0; x < width * depth; x += depth)
158 bytestream_put_byte(&buf, in_buf[x]);
void * av_malloc(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
AVFrame * coded_frame
the picture in the bitstream
#define FF_CODER_TYPE_RAW
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
static int encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
struct SgiContext SgiContext
static int init(AVCodecParserContext *s)
void av_free(void *ptr)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc(). ...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
static av_cold int encode_init(AVCodecContext *avctx)
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
void avcodec_get_frame_defaults(AVFrame *frame)
Set the fields of the given AVFrame to default values.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define SGI_MAGIC
SGI image file signature.
common internal api header.
#define AVERROR_INVALIDDATA
int key_frame
1 -> keyframe, 0-> not
int ff_rle_encode(uint8_t *outbuf, int out_size, const uint8_t *ptr, int bpp, int w, int add_rep, int xor_rep, int add_raw, int xor_raw)
RLE compress the row, with maximum size of out_size.
AVPixelFormat
Pixel format.
This structure stores compressed data.