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";
98 bytestream = pkt->
data;
99 bytestream_end = pkt->
data + pkt->
size;
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
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is st...
static av_cold int pam_encode_init(AVCodecContext *avctx)
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
16 bits gray, 16 bits alpha (big-endian)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
const char * name
Name of the codec implementation.
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
static int pam_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
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.
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
attribute_deprecated AVFrame * coded_frame
the picture in the bitstream
#define FF_ENABLE_DEPRECATION_WARNINGS
int key_frame
1 -> keyframe, 0-> not
AVPixelFormat
Pixel format.
This structure stores compressed data.