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(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;
Libavcodec external API header.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AV_PICTURE_TYPE_I
Intra.
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.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static int pgx_decode_header(AVCodecContext *avctx, GetByteContext *g, int *depth, int *width, int *height, int *sign)
#define WRITE_FRAME(D, PIXEL, suffix)
static int pgx_get_number(AVCodecContext *avctx, GetByteContext *g, int *number)
static int pgx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
@ AV_PIX_FMT_GRAY8
Y , 8bpp.
#define AV_PIX_FMT_GRAY16
main external API structure.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
int key_frame
1 -> keyframe, 0-> not
enum AVPictureType pict_type
Picture type of the frame.
This structure stores compressed data.
static void error(const char *err)