46 bytestream2_put_be32u(&
s->p, avctx->
width);
47 bytestream2_put_be32u(&
s->p, avctx->
height);
48 bytestream2_put_be32u(&
s->p,
s->depth);
49 bytestream2_put_be32u(&
s->p,
s->length);
50 bytestream2_put_be32u(&
s->p,
s->type);
51 bytestream2_put_be32u(&
s->p,
s->maptype);
52 bytestream2_put_be32u(&
s->p,
s->maplength);
57 const uint32_t *palette_data,
66 int len =
s->maplength / 3;
73 for (x = 0; x <
len; x++) {
74 uint32_t
pixel = palette_data[x];
76 bytestream2_put_byteu(&pb_r, (
pixel >> 16) & 0xFF);
77 bytestream2_put_byteu(&pb_g, (
pixel >> 8) & 0xFF);
78 bytestream2_put_byteu(&
s->p,
pixel & 0xFF);
92 #define GET_VALUE y >= avctx->height ? 0 : x >= len ? ptr[len-1] : ptr[x]
96 while (y < avctx->
height) {
102 ptr += linesize, y++;
111 ptr += linesize, y++;
118 bytestream2_put_byteu(&
s->p,
run - 1);
120 bytestream2_put_byteu(&
s->p,
value);
121 }
else if (
run == 1) {
122 bytestream2_put_byteu(&
s->p,
value);
124 bytestream2_put_be16u(&
s->p, (
value << 8) |
value);
130 for (y = 0; y < avctx->
height; y++) {
133 bytestream2_put_byteu(&
s->p, 0);
143 #if FF_API_CODER_TYPE
171 s->maplength = 3 * 256;
183 s->size = 32 +
s->maplength +
s->length *
s->type;
212 #define OFFSET(x) offsetof(SUNRASTContext, x)
213 #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
227 #if FF_API_CODER_TYPE
static const AVCodecDefault defaults[]
Libavcodec external API header.
#define FF_CODER_TYPE_RLE
#define FF_CODER_TYPE_RAW
static av_cold int init(AVCodecContext *avctx)
static av_always_inline void bytestream2_init_writer(PutByteContext *p, uint8_t *buf, int buf_size)
static av_always_inline int bytestream2_tell_p(PutByteContext *p)
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)
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
#define FF_API_CODER_TYPE
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define FF_DISABLE_DEPRECATION_WARNINGS
#define FF_ENABLE_DEPRECATION_WARNINGS
static enum AVPixelFormat pix_fmts[]
AVPixelFormat
Pixel format.
@ 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.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
attribute_deprecated int coder_type
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
This structure stores compressed data.
int flags
A combination of AV_PKT_FLAG values.
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 AVOption options[]
static const AVClass sunrast_class
AVCodec ff_sunrast_encoder
static const AVCodecDefault sunrast_defaults[]