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;
33 const char *tuple_type;
43 tuple_type =
"BLACKANDWHITE";
49 tuple_type =
"GRAYSCALE";
55 tuple_type =
"GRAYSCALE";
61 tuple_type =
"GRAYSCALE_ALPHA";
67 tuple_type =
"GRAYSCALE_ALPHA";
79 tuple_type =
"RGB_ALPHA";
91 tuple_type =
"RGB_ALPHA";
98 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
99 w,
h, depth, maxval, tuple_type);
106 memcpy(bytestream,
header, header_size);
107 bytestream += header_size;
114 for (
i = 0;
i <
h;
i++) {
115 for (j = 0; j <
w; j++)
116 *bytestream++ = ptr[j >> 3] >> (7 - j & 7) & 1;
120 for (
i = 0;
i <
h;
i++) {
121 memcpy(bytestream, ptr, n);
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.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
AVCodec p
The public AVCodec.
#define FF_CODEC_ENCODE_CB(func)
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
const FFCodec ff_pam_encoder
#define CODEC_LONG_NAME(str)
@ 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.
@ 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)