43 bytestream2_put_be32u(&s->
p, avctx->
width);
44 bytestream2_put_be32u(&s->
p, avctx->
height);
45 bytestream2_put_be32u(&s->
p, s->
depth);
46 bytestream2_put_be32u(&s->
p, s->
length);
47 bytestream2_put_be32u(&s->
p, s->
type);
48 bytestream2_put_be32u(&s->
p, s->
maptype);
54 const uint32_t *palette_data,
70 for (x = 0; x <
len; x++) {
71 uint32_t
pixel = palette_data[x];
73 bytestream2_put_byteu(&pb_r, (pixel >> 16) & 0xFF);
74 bytestream2_put_byteu(&pb_g, (pixel >> 8) & 0xFF);
75 bytestream2_put_byteu(&s->
p, pixel & 0xFF);
80 alen = len + (len & 1);
86 const uint8_t *start = linesize < 0 ? pixels + (avctx->
height - 1) * linesize
88 const uint8_t *end = linesize < 0 ? pixels - linesize
89 : pixels + avctx->
height * linesize;
93 #define GET_VALUE ptr >= end || ptr < start ? 0 : x >= len ? ptr[len-1] : ptr[x]
97 while (ptr < end && ptr >= start) {
107 while (value2 == value && run < 256 && ptr < end && ptr >= start) {
119 bytestream2_put_byteu(&s->
p, run - 1);
121 bytestream2_put_byteu(&s->
p, value);
122 }
else if (run == 1) {
123 bytestream2_put_byteu(&s->
p, value);
125 bytestream2_put_be16u(&s->
p, (value << 8) | value);
132 for (y = 0; y < avctx->
height; y++) {
135 bytestream2_put_byteu(&s->
p, 0);
187 const AVFrame *frame,
int *got_packet_ptr)
198 (
const uint32_t *)frame->
data[1],
This structure describes decoded (raw) audio or video data.
#define FF_CODER_TYPE_RLE
static const AVCodecDefault sunrast_defaults[]
AVFrame * coded_frame
the picture in the bitstream
#define FF_CODER_TYPE_RAW
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int length
length (bytes) of image
static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
8 bit with PIX_FMT_RGB32 palette
int maplength
length (bytes) of colormap
static int init(AVCodecParserContext *s)
static const AVCodecDefault defaults[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
int maptype
type of colormap
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
int flags
A combination of AV_PKT_FLAG values.
static av_always_inline void bytestream2_skip_p(PutByteContext *p, unsigned int size)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
AVCodec ff_sunrast_encoder
packed RGB 8:8:8, 24bpp, BGRBGR...
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void sunrast_image_write_image(AVCodecContext *avctx, const uint8_t *pixels, const uint32_t *palette_data, int linesize)
static void sunrast_image_write_header(AVCodecContext *avctx)
static av_cold int sunrast_encode_init(AVCodecContext *avctx)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
struct SUNRASTContext SUNRASTContext
int key_frame
1 -> keyframe, 0-> not
AVPixelFormat
Pixel format.
This structure stores compressed data.