36 digit = bytestream2_get_byte(g);
37 if (digit ==
' ' || digit == 0xA || digit == 0xD)
39 else if (digit < '0' || digit >
'9')
42 temp = (uint64_t)10 * (*number) + (digit -
'0');
65 byte = bytestream2_peek_byte(g);
69 }
else if (byte ==
'-') {
75 byte = bytestream2_peek_byte(g);
88 if (bytestream2_peek_byte(g) == 0xA)
97 #define WRITE_FRAME(D, PIXEL, suffix) \ 98 static inline void write_frame_ ##D(AVPacket *avpkt, AVFrame *frame, GetByteContext *g, \ 99 int width, int height, int sign, int depth) \ 102 for (i = 0; i < height; i++) { \ 103 PIXEL *line = (PIXEL*)frame->data[0] + i*frame->linesize[0]/sizeof(PIXEL); \ 104 for (j = 0; j < width; j++) { \ 107 val = (PIXEL)bytestream2_get_ ##suffix(g) + (1 << (depth - 1)); \ 109 val = bytestream2_get_ ##suffix(g); \ 110 val <<= (D - depth); \ 136 if (depth > 0 && depth <= 8) {
139 }
else if (depth > 0 && depth <= 16) {
152 avctx->bits_per_raw_sample = depth;
154 write_frame_8(avpkt, p, &g, width, height, sign, depth);
156 write_frame_16(avpkt, p, &g, width, height, sign, depth);
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
This structure describes decoded (raw) audio or video data.
ptrdiff_t const GLvoid * data
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.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g, int *depth, int *width, int *height, int *sign)
static void error(const char *err)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
#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.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL be16
#define WRITE_FRAME(D, PIXEL, suffix)
enum AVPictureType pict_type
Picture type of the frame.
#define AV_PIX_FMT_GRAY16
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Libavcodec external API header.
static int pgx_get_number(AVCodecContext *avctx, GetByteContext *g, int *number)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
main external API structure.
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
common internal api header.
int key_frame
1 -> keyframe, 0-> not
static int pgx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
This structure stores compressed data.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() for allocating buffers and supports custom allocators.