31 const uint8_t *buf = avpkt->
data;
32 int buf_size = avpkt->
size;
36 int i, j, n, linesize, h, upgrade = 0;
38 int components, sample_len;
88 n = (avctx->
width + 7) >> 3;
97 for (i=0; i<avctx->
height; i++) {
100 for(j=0; j<avctx->
width * components; j++){
117 for (i = 0; i < avctx->
height; i++) {
120 else if (upgrade == 1) {
122 for (j = 0; j < n; j++)
124 }
else if (upgrade == 2) {
125 unsigned int j,
v,
f = (65535 * 32768 + s->
maxval / 2) / s->
maxval;
126 for (j = 0; j < n / 2; j++) {
128 ((uint16_t *)ptr)[j] = (v * f + 16384) >> 15;
138 unsigned char *ptr1, *ptr2;
145 for (i = 0; i < avctx->
height; i++) {
154 for (i = 0; i < h; i++) {
169 for (i = 0; i < avctx->
height; i++) {
172 for (j = 0; j < avctx->
width; j++) {
177 ((uint32_t *)ptr)[j] = (a << 24) | (r << 16) | (g << 8) | b;
190 #if CONFIG_PGM_DECODER
205 #if CONFIG_PGMYUV_DECODER
220 #if CONFIG_PPM_DECODER
235 #if CONFIG_PBM_DECODER
250 #if CONFIG_PAM_DECODER
struct PNMContext PNMContext
int(* get_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called at the beginning of each frame to get a buffer for it.
enum PixelFormat pix_fmt
Pixel format, see PIX_FMT_xxx.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
void(* release_buffer)(struct AVCodecContext *c, AVFrame *pic)
Called to release buffers which were allocated with get_buffer.
int maxval
maximum value of a pixel
four components are given, that's all.
static int decode(MimicContext *ctx, int quality, int num_coeffs, int is_iframe)
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
static int init(AVCodecParserContext *s)
#define CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.
Y , 16bpp, little-endian.
int reference
is this picture used as reference The values for this are the same as the MpegEncContext.picture_structure variable, that is 1->top field, 2->bottom field, 3->frame/both fields.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int pnm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big...
void av_log(void *avcl, int level, const char *fmt,...)
const char * name
Name of the codec implementation.
static void put_bits(PutBitContext *s, int n, unsigned int value)
Write up to 31 bits into a bitstream.
av_cold int ff_pnm_end(AVCodecContext *avctx)
enum AVPictureType pict_type
Picture type of the frame, see ?_TYPE below.
int width
picture width / height.
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext *const s)
int linesize[AV_NUM_DATA_POINTERS]
Size, in bytes, of the data for each picture/channel plane.
main external API structure.
static void close(AVCodecParserContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
static void flush_put_bits(PutBitContext *s)
Pad the end of the output stream with zeros.
static void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size)
Initialize the PutBitContext s.
uint8_t * bytestream_start
av_cold int ff_pnm_init(AVCodecContext *avctx)
packed RGB 8:8:8, 24bpp, RGBRGB...
int key_frame
1 -> keyframe, 0-> not