32 return c ==
' ' || c ==
'\n' || c ==
'\r' || c ==
'\t';
54 if ((s - str) < buf_size - 1)
63 char buf1[32], tuple_type[32];
74 }
else if (s->
type==2 || s->
type==5) {
79 }
else if (s->
type==3 || s->
type==6) {
81 }
else if (s->
type==7) {
89 if (!strcmp(buf1,
"WIDTH")) {
91 w = strtol(buf1,
NULL, 10);
92 }
else if (!strcmp(buf1,
"HEIGHT")) {
94 h = strtol(buf1,
NULL, 10);
95 }
else if (!strcmp(buf1,
"DEPTH")) {
97 depth = strtol(buf1,
NULL, 10);
98 }
else if (!strcmp(buf1,
"MAXVAL")) {
100 maxval = strtol(buf1,
NULL, 10);
101 }
else if (!strcmp(buf1,
"TUPLTYPE") ||
103 !strcmp(buf1,
"TUPLETYPE")) {
104 pnm_get(s, tuple_type,
sizeof(tuple_type));
105 }
else if (!strcmp(buf1,
"ENDHDR")) {
112 if (w <= 0 || h <= 0 || maxval <= 0 || maxval > UINT16_MAX || depth <= 0 || tuple_type[0] ==
'\0' ||
123 }
else if (maxval < 256) {
128 }
else if (depth == 2) {
134 }
else if (depth == 3) {
140 }
else if (depth == 4) {
153 pnm_get(s, buf1,
sizeof(buf1));
155 pnm_get(s, buf1,
sizeof(buf1));
165 pnm_get(s, buf1,
sizeof(buf1));
179 else if (s->
maxval < 1024)
193 if ((avctx->
width & 1) != 0)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
static int pnm_space(int c)
packed RGB 8:8:8, 24bpp, RGBRGB...
int ff_set_dimensions(AVCodecContext *s, int width, int height)
Check that the provided frame dimensions are valid and set them on the codec context.
#define AV_PIX_FMT_RGBA64
int maxval
maximum value of a pixel
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static void pnm_get(PNMContext *sc, char *str, int buf_size)
packed RGBA 8:8:8:8, 32bpp, RGBARGBA...
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
#define AV_PIX_FMT_GRAY16
int width
picture width / height.
#define AV_PIX_FMT_YUV420P16
Libavcodec external API header.
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext *const s)
main external API structure.
#define AV_PIX_FMT_YUV420P10
#define AV_PIX_FMT_YUV420P9
Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb...
planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples)
common internal api header.
Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb...
#define AV_PIX_FMT_FLAG_PLANAR
At least one pixel component is not in the first data plane.