Go to the documentation of this file.
35 const uint8_t **poutbuf,
int *poutbuf_size,
36 const uint8_t *buf,
int buf_size)
83 }
else if (pnmctx.
type < 4) {
86 const uint8_t *sync = bs;
98 uint8_t *match = memchr(bs,
'\n', end-bs);
103 }
else if (
c ==
'P') {
116 if (
ret >= 0 && next + (uint64_t)
ret <= INT_MAX)
121 if (next > buf_size) {
132 *poutbuf_size = buf_size;
int overread_index
the index into ParseContext.buffer of the overread bytes
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But a word about which is also called distortion Distortion can be quantified by almost any quality measurement one chooses the sum of squared differences is used but more complex methods that consider psychovisual effects can be used as well It makes no difference in this discussion First step
void ff_parse_close(AVCodecParserContext *s)
const uint8_t * bytestream_end
const uint8_t * bytestream_start
static int pnm_parse(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size)
int overread
the number of bytes which where irreversibly read from the next frame
#define av_assert0(cond)
assert() equivalent, that is always enabled.
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
static int inc(int num, int period)
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.
int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_size)
Combine the (truncated) bitstream to a complete frame.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
const AVCodecParser ff_pnm_parser
main external API structure.
const uint8_t * bytestream
int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext *const s)
int width
picture width / height.
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.