29 const AVFrame *p,
int *got_packet)
31 uint8_t *bytestream, *bytestream_start, *bytestream_end;
32 int i,
h, h1,
c, n, linesize,
ret;
41 bytestream = pkt->
data;
42 bytestream_end = pkt->
data + pkt->
size;
49 n = (avctx->
width + 7) >> 3;
88 snprintf(bytestream, bytestream_end - bytestream,
89 "P%c\n%d %d\n", c, avctx->
width, h1);
90 bytestream += strlen(bytestream);
92 snprintf(bytestream, bytestream_end - bytestream,
94 bytestream += strlen(bytestream);
98 snprintf(bytestream, bytestream_end - bytestream,
100 bytestream += strlen(bytestream);
104 float *
r = (
float *)p->
data[2];
105 float *
g = (
float *)p->
data[0];
106 float *
b = (
float *)p->
data[1];
108 for (
int i = 0; i < avctx->
height; i++) {
109 for (
int j = 0; j < avctx->
width; j++) {
123 for (i = 0; i <
h; i++) {
124 memcpy(bytestream, ptr, n);
135 for (i = 0; i <
h; i++) {
136 memcpy(bytestream, ptr1, n);
138 memcpy(bytestream, ptr2, n);
144 pkt->
size = bytestream - bytestream_start;
153 #if FF_API_CODED_FRAME 163 #if CONFIG_PGM_ENCODER 178 #if CONFIG_PGMYUV_ENCODER 193 #if CONFIG_PPM_ENCODER 208 #if CONFIG_PBM_ENCODER 222 #if CONFIG_PFM_ENCODER const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
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.
int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
Check AVPacket size and/or allocate data.
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
AVComponentDescriptor comp[4]
Parameters that describe how pixels are packed.
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align)
Return the size in bytes of the amount of data required to store an image with the given parameters...
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVCodec ff_pgmyuv_encoder
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static av_cold int pnm_encode_init(AVCodecContext *avctx)
const char * name
Name of the codec implementation.
int flags
A combination of AV_PKT_FLAG values.
enum AVPictureType pict_type
Picture type of the frame.
int width
picture width / height.
static int pnm_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *p, int *got_packet)
planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian
Libavcodec external API header.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
main external API structure.
IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian.
static av_always_inline uint32_t av_float2int(float f)
Reinterpret a float as a 32-bit integer.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
#define AV_PIX_FMT_GBRPF32
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
#define FF_DISABLE_DEPRECATION_WARNINGS
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
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
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later.That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another.Frame references ownership and permissions
int depth
Number of bits in the component.
AVPixelFormat
Pixel format.
This structure stores compressed data.