28 #define SGI_SINGLE_CHAN 2
29 #define SGI_MULTI_CHAN 3
33 if (avctx->
width > 65535 || avctx->
height > 65535) {
45 uint8_t *offsettab, *lengthtab, *in_buf, *encode_buf, *
buf;
47 unsigned int width,
height,
depth, dimension, bytes_per_channel, pixmax, put_be;
48 unsigned char *end_buf;
55 bytes_per_channel = 1;
76 bytes_per_channel = 2;
85 bytes_per_channel = 2;
94 bytes_per_channel = 2;
103 tablesize = depth * height * 4;
106 length += depth * height *
width;
108 length += tablesize * 2 + depth * height * (2 * width + 1);
118 bytestream_put_byte(&buf, bytes_per_channel);
119 bytestream_put_be16(&buf, dimension);
120 bytestream_put_be16(&buf, width);
121 bytestream_put_be16(&buf, height);
122 bytestream_put_be16(&buf, depth);
124 bytestream_put_be32(&buf, 0
L);
125 bytestream_put_be32(&buf, pixmax);
126 bytestream_put_be32(&buf, 0
L);
133 bytestream_put_be32(&buf, 0
L);
151 for (z = 0; z <
depth; z++) {
152 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z;
154 for (y = 0; y <
height; y++) {
155 bytestream_put_be32(&offsettab, buf - pkt->
data);
157 for (x = 0; x <
width; x++)
158 encode_buf[x] = in_buf[depth * x];
160 if ((length =
ff_rle_encode(buf, end_buf - buf - 1, encode_buf, 1, width, 0, 0, 0x80, 0)) < 1) {
166 bytestream_put_byte(&buf, 0);
167 bytestream_put_be32(&lengthtab, length + 1);
174 for (z = 0; z <
depth; z++) {
175 in_buf = p->
data[0] + p->
linesize[0] * (height - 1) + z * bytes_per_channel;
177 for (y = 0; y <
height; y++) {
179 if (bytes_per_channel == 1) {
180 bytestream_put_byte(&buf, in_buf[x]);
183 bytestream_put_be16(&buf, ((uint16_t *)in_buf)[x]);
185 bytestream_put_le16(&buf, ((uint16_t *)in_buf)[x]);
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
void av_log(void *avcl, int level, const char *fmt,...) av_printf_format(3
Send the specified message to the log if the level is less than or equal to the current av_log_level...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
const char * name
Name of the codec implementation.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
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. ...
Libavcodec external API header.
AVPixelFormat
Pixel format.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
void * av_malloc(size_t size) av_malloc_attrib 1(1)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...
static av_cold int encode_init(AVCodecContext *avctx)
int AC3_NAME() encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
main external API structure.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
BYTE int const BYTE int int int height
#define FF_CODER_TYPE_RAW
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Y , 16bpp, little-endian.
#define SGI_MAGIC
SGI image file signature.
common internal api header.
#define AVERROR_INVALIDDATA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
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.
This structure stores compressed data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as lit...