37 #if FF_API_CODED_FRAME 58 const uint8_t *
src,
int src_plane_size,
int nplanes)
64 if (dst_size < 2LL * src_plane_size * nplanes || src_plane_size <= 0)
67 for (p = 0; p < nplanes; p++) {
69 const uint8_t *src_plane = src + p;
70 const uint8_t *src_plane_end = src_plane + src_plane_size * nplanes;
74 for (; ; src_plane += nplanes) {
75 if (src_plane < src_plane_end && *src_plane == prev && count < 0x3F) {
80 if (count != 1 || prev >= 0xC0)
81 *dst++ = 0xC0 | count;
84 if (src_plane == src_plane_end)
94 return dst - dst_start;
98 const AVFrame *frame,
int *got_packet)
103 int bpp, nplanes, i, y, line_bytes, written, ret, max_pkt_size;
104 const uint32_t *pal =
NULL;
107 if (avctx->
width > 65535 || avctx->
height > 65535) {
125 pal = (uint32_t *)frame->
data[1];
137 line_bytes = (avctx->
width * bpp + 7) >> 3;
138 line_bytes = (line_bytes + 1) & ~1;
140 max_pkt_size = 128 + avctx->
height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0);
142 av_log(avctx,
AV_LOG_ERROR,
"Error getting output packet of size %d.\n", max_pkt_size);
148 bytestream_put_byte(&buf, 10);
149 bytestream_put_byte(&buf, 5);
150 bytestream_put_byte(&buf, 1);
151 bytestream_put_byte(&buf, bpp);
152 bytestream_put_le16(&buf, 0);
153 bytestream_put_le16(&buf, 0);
154 bytestream_put_le16(&buf, avctx->
width - 1);
155 bytestream_put_le16(&buf, avctx->
height - 1);
156 bytestream_put_le16(&buf, 0);
157 bytestream_put_le16(&buf, 0);
158 for (i = 0; i < 16; i++)
159 bytestream_put_be24(&buf, pal ? pal[i] : 0);
160 bytestream_put_byte(&buf, 0);
161 bytestream_put_byte(&buf, nplanes);
162 bytestream_put_le16(&buf, line_bytes);
164 while (buf - pkt->
data < 128)
167 src = frame->
data[0];
169 for (y = 0; y < avctx->
height; y++) {
171 src, line_bytes, nplanes)) < 0) {
179 if (nplanes == 1 && bpp == 8) {
180 if (buf_end - buf < 257) {
184 bytestream_put_byte(&buf, 12);
185 for (i = 0; i < 256; i++) {
186 bytestream_put_be24(&buf, pal[i]);
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
av_log(ac->avr, AV_LOG_TRACE, "%d samples - audio_convert: %s to %s (%s)\, len, av_get_sample_fmt_name(ac->in_fmt), av_get_sample_fmt_name(ac->out_fmt), use_generic ? ac->func_descr_generic :ac->func_descr)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
8 bits with AV_PIX_FMT_RGB32 palette
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int pcx_rle_encode(uint8_t *dst, int dst_size, const uint8_t *src, int src_plane_size, int nplanes)
PCX run-length encoder.
const char * name
Name of the codec implementation.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
int width
picture width / height.
static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
int ff_alloc_packet(AVPacket *avpkt, int size)
Check AVPacket size and/or allocate data.
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
#define AVERROR_BUG
Bug detected, please report the issue.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
#define FF_ENABLE_DEPRECATION_WARNINGS
int key_frame
1 -> keyframe, 0-> not
static const uint32_t monoblack_pal[16]
static av_cold int pcx_encode_init(AVCodecContext *avctx)
AVPixelFormat
Pixel format.
This structure stores compressed data.