48 bytestream2_put_be32u(&
s->p, avctx->
width);
49 bytestream2_put_be32u(&
s->p, avctx->
height);
50 bytestream2_put_be32u(&
s->p,
s->depth);
51 bytestream2_put_be32u(&
s->p,
s->length);
52 bytestream2_put_be32u(&
s->p,
s->type);
53 bytestream2_put_be32u(&
s->p,
s->maptype);
54 bytestream2_put_be32u(&
s->p,
s->maplength);
58 const uint8_t *pixels,
59 const uint32_t *palette_data,
68 int len =
s->maplength / 3;
75 for (x = 0; x <
len; x++) {
76 uint32_t
pixel = palette_data[x];
78 bytestream2_put_byteu(&pb_r, (
pixel >> 16) & 0xFF);
79 bytestream2_put_byteu(&pb_g, (
pixel >> 8) & 0xFF);
80 bytestream2_put_byteu(&
s->p,
pixel & 0xFF);
89 uint8_t
value, value2;
94#define GET_VALUE y >= avctx->height ? 0 : x >= len ? ptr[len-1] : ptr[x]
98 while (y < avctx->
height) {
104 ptr += linesize, y++;
113 ptr += linesize, y++;
120 bytestream2_put_byteu(&
s->p,
run - 1);
122 bytestream2_put_byteu(&
s->p,
value);
123 }
else if (
run == 1) {
124 bytestream2_put_byteu(&
s->p,
value);
126 bytestream2_put_be16u(&
s->p, (
value << 8) |
value);
132 for (y = 0; y < avctx->
height; y++) {
135 bytestream2_put_byteu(&
s->p, 0);
157 s->maplength = 3 * 256;
169 s->size = 32 +
s->maplength +
s->length *
s->type;
186 (
const uint32_t *)
frame->data[1],
197#define OFFSET(x) offsetof(SUNRASTContext, x)
198#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
206 .class_name =
"sunrast",
const FFCodec ff_sunrast_encoder
Libavcodec external API header.
static av_always_inline int bytestream2_tell_p(const PutByteContext *p)
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip_p(PutByteContext *p, unsigned int size)
static av_always_inline unsigned int bytestream2_put_buffer(PutByteContext *p, const uint8_t *src, unsigned int size)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
int(* init)(AVBSFContext *ctx)
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
@ AV_OPT_TYPE_INT
Underlying C type is int.
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
Macro definitions for various function/variable attributes.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
@ AV_PIX_FMT_BGR24
packed RGB 8:8:8, 24bpp, BGRBGR...
@ AV_PIX_FMT_MONOWHITE
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb.
Describe the class of an AVClass context structure.
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
int maptype
type of colormap
int maplength
length (bytes) of colormap
int length
length (bytes) of image
static int sunrast_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
static void sunrast_image_write_header(AVCodecContext *avctx)
static av_cold int sunrast_encode_init(AVCodecContext *avctx)
static void sunrast_image_write_image(AVCodecContext *avctx, const uint8_t *pixels, const uint32_t *palette_data, int linesize)
static const AVClass sunrast_class