55 int outcnt = 0, maxcnt;
65 if (avpkt->
size < 2 +
w*
h / 513)
75 if (!
c->frame_buffer) {
78 if (!
c->frame_buffer || !
c->last_frame_buffer) {
89 prev = (
uint8_t*)
c->last_frame_buffer;
91 for (
i = 0;
i < 8;
i++)
94 while (outcnt < maxcnt && buf_end - 2 >= buf) {
98 if (!(
code & 0x8000)) {
104 if ((
code & 0x6000) == 0x6000) {
106 int oidx = (
code >> 10) & 7;
109 count = (
code & 0x3FF) + 3;
112 if (buf_end - 3 < buf)
118 start = (outcnt +
offsets[oidx]) % maxcnt;
120 if (maxcnt - start < count || maxcnt - outcnt < count)
125 "Frame reference does not exist\n");
129 memcpy(
out + 2 * outcnt, prev + 2 * start, 2 * count);
134 if (!(
code & 0x6000)) {
136 }
else if ((
code & 0x6000) == 0x2000) {
139 if (buf_end - 1 < buf)
144 if (outcnt <
offset || maxcnt - outcnt < count)
159 FFSWAP(uint16_t *,
c->frame_buffer,
c->last_frame_buffer);
static void flush(AVCodecContext *avctx)
Libavcodec external API header.
static av_cold int init(AVCodecContext *avctx)
common internal and external API header
#define FFSWAP(type, a, b)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
void av_memcpy_backptr(uint8_t *dst, int back, int cnt)
Overlapping memcpy() implementation.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void av_image_copy_plane(uint8_t *dst, int dst_linesize, const uint8_t *src, int src_linesize, int bytewidth, int height)
Copy image plane from src to dst.
static const int offsets[]
static av_cold int decode_init(AVCodecContext *avctx)
static av_cold int decode_end(AVCodecContext *avctx)
static void decode_flush(AVCodecContext *avctx)
static int decode_frame(AVCodecContext *avctx, void *data, 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.
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
#define AV_PIX_FMT_RGB555
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
const char * name
Name of the codec implementation.
This structure describes decoded (raw) audio or video data.
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
This structure stores compressed data.
uint16_t * last_frame_buffer
static const uint8_t offset[127][2]