Go to the documentation of this file.
28 const AVFrame *p,
int *got_packet)
30 int i,
h,
w, n, linesize, depth, maxval,
ret, header_size;
31 uint8_t *bytestream, *ptr;
32 const char *tuple_type;
42 tuple_type =
"BLACKANDWHITE";
48 tuple_type =
"GRAYSCALE";
54 tuple_type =
"GRAYSCALE";
60 tuple_type =
"GRAYSCALE_ALPHA";
66 tuple_type =
"GRAYSCALE_ALPHA";
78 tuple_type =
"RGB_ALPHA";
90 tuple_type =
"RGB_ALPHA";
97 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
98 w,
h, depth, maxval, tuple_type);
105 memcpy(bytestream,
header, header_size);
106 bytestream += header_size;
113 for (
i = 0;
i <
h;
i++) {
114 for (j = 0; j <
w; j++)
115 *bytestream++ = ptr[j >> 3] >> (7 - j & 7) & 1;
119 for (
i = 0;
i <
h;
i++) {
120 memcpy(bytestream, ptr, n);
#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.
This structure describes decoded (raw) audio or video data.
@ AV_PIX_FMT_RGBA64BE
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
const AVCodec ff_pam_encoder
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
@ AV_PIX_FMT_RGBA
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
@ AV_PIX_FMT_GRAY8A
alias for AV_PIX_FMT_YA8
@ 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_GRAY8
Y , 8bpp.
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
static const uint8_t header[24]
@ AV_PIX_FMT_RGB48BE
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
#define i(width, name, range_min, range_max)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
main external API structure.
int ff_get_encode_buffer(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int flags)
Get a buffer for a packet.
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, a positive or negative value, which is typically indicating the size in bytes of each pict...
static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)