Go to the documentation of this file.
36 digit = bytestream2_get_byteu(
g);
37 if (digit ==
' ' || digit == 0xA || digit == 0xD)
39 else if (digit < '0' || digit >
'9')
42 temp = (uint64_t)10 * (*number) + (digit -
'0');
64 byte = bytestream2_peek_byteu(
g);
68 }
else if (
byte ==
'-') {
73 byte = bytestream2_peek_byteu(
g);
84 if (bytestream2_peek_byte(
g) == 0xA)
93 #define WRITE_FRAME(D, PIXEL, suffix) \
94 static inline void write_frame_ ##D(AVFrame *frame, GetByteContext *g, \
95 int width, int height, int sign, int depth) \
97 const unsigned offset = sign ? (1 << (D - 1)) : 0; \
99 for (i = 0; i < height; i++) { \
100 PIXEL *line = (PIXEL*)(frame->data[0] + i * frame->linesize[0]); \
101 for (j = 0; j < width; j++) { \
102 unsigned val = bytestream2_get_ ##suffix##u(g) << (D - depth); \
128 if (depth > 0 && depth <= 8) {
131 }
else if (depth > 0 && depth <= 16) {
144 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)
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_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 AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define WRITE_FRAME(D, PIXEL, suffix)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
#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.
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)
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.