Go to the documentation of this file.
37 digit = bytestream2_get_byteu(
g);
38 if (digit ==
' ' || digit == 0xA || digit == 0xD)
40 else if (digit < '0' || digit >
'9')
43 temp = (uint64_t)10 * (*number) + (digit -
'0');
65 byte = bytestream2_peek_byteu(
g);
69 }
else if (
byte ==
'-') {
74 byte = bytestream2_peek_byteu(
g);
85 if (bytestream2_peek_byte(
g) == 0xA)
94 #define WRITE_FRAME(D, PIXEL, suffix) \
95 static inline void write_frame_ ##D(AVFrame *frame, GetByteContext *g, \
96 int width, int height, int sign, int depth) \
98 const unsigned offset = sign ? (1 << (D - 1)) : 0; \
100 for (i = 0; i < height; i++) { \
101 PIXEL *line = (PIXEL*)(frame->data[0] + i * frame->linesize[0]); \
102 for (j = 0; j < width; j++) { \
103 unsigned val = bytestream2_get_ ##suffix##u(g) << (D - depth); \
129 if (depth > 0 && depth <= 8) {
132 }
else if (depth > 0 && depth <= 16) {
145 avctx->bits_per_raw_sample = depth;
static void error(const char *err)
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
This structure describes decoded (raw) audio or video data.
static int pgx_get_number(AVCodecContext *avctx, GetByteContext *g, int *number)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
AVCodec p
The public AVCodec.
#define AV_PIX_FMT_GRAY16
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define WRITE_FRAME(D, PIXEL, suffix)
#define FF_CODEC_DECODE_CB(func)
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
@ AV_PICTURE_TYPE_I
Intra.
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g, int *depth, int *width, int *height, int *sign)
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
const FFCodec ff_pgx_decoder
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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
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
main external API structure.
static int pgx_decode_frame(AVCodecContext *avctx, AVFrame *p, int *got_frame, AVPacket *avpkt)
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.
This structure stores compressed data.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.