Go to the documentation of this file.
48 const uint8_t *
src,
int src_plane_size,
int nplanes)
51 const uint8_t *dst_start = dst;
54 if (dst_size < 2LL * src_plane_size * nplanes || src_plane_size <= 0)
57 for (p = 0; p < nplanes; p++) {
59 const uint8_t *src_plane =
src + p;
60 const uint8_t *src_plane_end = src_plane + src_plane_size * nplanes;
61 uint8_t prev = *src_plane;
64 for (; ; src_plane += nplanes) {
65 if (src_plane < src_plane_end && *src_plane == prev && count < 0x3F) {
70 if (count != 1 || prev >= 0xC0)
71 *dst++ = 0xC0 | count;
74 if (src_plane == src_plane_end)
84 return dst - dst_start;
90 const uint8_t *buf_end;
93 int bpp, nplanes,
i, y, line_bytes, written,
ret, max_pkt_size, sw, sh;
94 const uint32_t *pal =
NULL;
95 uint32_t palette256[256];
98 if (avctx->
width > 65535 || avctx->
height > 65535) {
121 pal = (uint32_t *)
frame->data[1];
133 line_bytes = (avctx->
width * bpp + 7) >> 3;
134 line_bytes = (line_bytes + 1) & ~1;
136 max_pkt_size = 128 + avctx->
height * 2 * line_bytes * nplanes + (pal ? 256*3 + 1 : 0);
144 if (sw > 0xFFFFu || sh > 0xFFFFu)
147 bytestream_put_byte(&buf, 10);
148 bytestream_put_byte(&buf, 5);
149 bytestream_put_byte(&buf, 1);
150 bytestream_put_byte(&buf, bpp);
151 bytestream_put_le16(&buf, 0);
152 bytestream_put_le16(&buf, 0);
153 bytestream_put_le16(&buf, avctx->
width - 1);
154 bytestream_put_le16(&buf, avctx->
height - 1);
155 bytestream_put_le16(&buf, sw);
156 bytestream_put_le16(&buf, sh);
157 for (
i = 0;
i < 16;
i++)
158 bytestream_put_be24(&buf, pal ? pal[
i] : 0);
159 bytestream_put_byte(&buf, 0);
160 bytestream_put_byte(&buf, nplanes);
161 bytestream_put_le16(&buf, line_bytes);
168 for (y = 0; y < avctx->
height; y++) {
170 src, line_bytes, nplanes)) < 0) {
178 if (nplanes == 1 && bpp == 8) {
179 if (buf_end - buf < 257) {
183 bytestream_put_byte(&buf, 12);
184 for (
i = 0;
i < 256;
i++) {
185 bytestream_put_be24(&buf, pal[
i]);
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
AVPixelFormat
Pixel format.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
This structure describes decoded (raw) audio or video data.
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
@ AV_PIX_FMT_BGR8
packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt)
static const uint32_t monoblack_pal[16]
@ AV_PIX_FMT_MONOBLACK
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb.
@ AV_PIX_FMT_RGB8
packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_BGR4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb)
const AVCodec ff_pcx_encoder
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define i(width, name, range_min, range_max)
const char * name
Name of the codec implementation.
@ AV_PIX_FMT_RGB4_BYTE
packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb)
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
these buffered frames must be flushed immediately if a new input produces new the filter must not call request_frame to get more It must just process the frame or queue it The task of requesting more frames is left to the filter s request_frame method or the application If a filter has several the filter must be ready for frames arriving randomly on any input any filter with several inputs will most likely require some kind of queuing mechanism It is perfectly acceptable to have a limited queue and to drop frames when the inputs are too unbalanced request_frame For filters that do not use the this method is called when a frame is wanted on an output For a it should directly call filter_frame on the corresponding output For a if there are queued frames already one of these frames should be pushed If the filter should request a frame on one of its repeatedly until at least one frame has been pushed Return or at least make progress towards producing a frame
main external API structure.
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.
static int pcx_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet)
This structure stores compressed data.
int width
picture width / height.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
int ff_alloc_packet(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and allocate data.
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown) That is the width of a pixel divided by the height of the pixel.