Go to the documentation of this file.
26 const AVFrame *p,
int *got_packet)
28 uint8_t *bytestream_start, *bytestream, *bytestream_end;
29 int i,
h,
w, n, linesize, depth, maxval,
ret;
30 const char *tuple_type;
40 tuple_type =
"BLACKANDWHITE";
46 tuple_type =
"GRAYSCALE";
52 tuple_type =
"GRAYSCALE";
58 tuple_type =
"GRAYSCALE_ALPHA";
64 tuple_type =
"GRAYSCALE_ALPHA";
76 tuple_type =
"RGB_ALPHA";
88 tuple_type =
"RGB_ALPHA";
101 snprintf(bytestream, bytestream_end - bytestream,
102 "P7\nWIDTH %d\nHEIGHT %d\nDEPTH %d\nMAXVAL %d\nTUPLTYPE %s\nENDHDR\n",
103 w,
h, depth, maxval, tuple_type);
104 bytestream += strlen(bytestream);
111 for (
i = 0;
i <
h;
i++) {
112 for (j = 0; j <
w; j++)
113 *bytestream++ = ptr[j >> 3] >> (7 - j & 7) & 1;
117 for (
i = 0;
i <
h;
i++) {
118 memcpy(bytestream, ptr, n);
124 pkt->
size = bytestream - bytestream_start;
132 #if FF_API_CODED_FRAME
#define FF_ENABLE_DEPRECATION_WARNINGS
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...
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
@ AV_PIX_FMT_GRAY16BE
Y , 16bpp, big-endian.
int key_frame
1 -> keyframe, 0-> not
@ 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_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
enum AVPictureType pict_type
Picture type of the frame.
@ 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.
@ AV_PIX_FMT_YA16BE
16 bits gray, 16 bits alpha (big-endian)
int flags
A combination of AV_PKT_FLAG values.
@ 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)
const char * name
Name of the codec implementation.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
main external API structure.
#define FF_DISABLE_DEPRECATION_WARNINGS
This structure stores compressed data.
int width
picture width / height.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
static av_cold int pam_encode_init(AVCodecContext *avctx)
static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)