26 const AVFrame *p,
int *got_packet)
28 uint8_t *bytestream_start, *bytestream, *bytestream_end;
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;
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size)
Check AVPacket size and/or allocate data.
This structure describes decoded (raw) audio or video data.
packed RGB 8:8:8, 24bpp, RGBRGB...
AVFrame * coded_frame
the picture in the bitstream
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
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.
16bit gray, 16bit alpha (big-endian)
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
#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.
Libavcodec external API header.
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.
static av_cold int pam_encode_close(AVCodecContext *avctx)
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
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...
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...
int key_frame
1 -> keyframe, 0-> not
AVPixelFormat
Pixel format.
This structure stores compressed data.