70 int mask = 0x10000, bitbuf = 0;
75 segments = bytestream2_get_le32(gb);
76 offset = bytestream2_get_le32(gb);
85 if (
mask == 0x10000) {
86 bitbuf = bytestream2_get_le16u(gb);
92 v = bytestream2_get_le16(gb);
93 offset = (v & 0x1FFF) << 1;
94 count = ((v >> 13) + 2) << 1;
100 *
frame++ = bytestream2_get_byte(gb);
101 *
frame++ = bytestream2_get_byte(gb);
113 int mask = 0x10000, bitbuf = 0;
114 int v,
offset, count, segments;
116 segments = bytestream2_get_le16(gb);
120 if (
mask == 0x10000) {
121 bitbuf = bytestream2_get_le16u(gb);
127 v = bytestream2_get_le16(gb);
128 offset = (v & 0x1FFF) << 1;
129 count = ((v >> 13) + 2) << 1;
134 }
else if (bitbuf & (
mask << 1)) {
135 frame += bytestream2_get_le16(gb);
137 *
frame++ = bytestream2_get_byte(gb);
138 *
frame++ = bytestream2_get_byte(gb);
150 int mask = 0x10000, bitbuf = 0;
151 int i, v,
offset, count, segments;
155 segments = bytestream2_get_le16(gb);
159 if (
mask == 0x10000) {
160 bitbuf = bytestream2_get_le16u(gb);
165 v = bytestream2_get_le16(gb);
166 offset = (v & 0x1FFF) << 2;
167 count = ((v >> 13) + 2) << 1;
170 for (
i = 0;
i < count;
i++) {
176 }
else if (bitbuf & (
mask << 1)) {
177 v = bytestream2_get_le16(gb)*2;
200 int count, lines, segments;
202 count = bytestream2_get_le16(gb);
206 lines = bytestream2_get_le16(gb);
207 if (count + lines >
height)
215 segments = bytestream2_get_byteu(gb);
217 if (
frame - line_ptr <= bytestream2_peek_byte(gb))
219 line_ptr += bytestream2_get_byte(gb);
220 count = (int8_t)bytestream2_get_byte(gb);
222 if (
frame - line_ptr < count)
228 if (
frame - line_ptr < count)
230 memset(line_ptr, bytestream2_get_byte(gb), count);
243 int count,
i, v, lines, segments;
246 lines = bytestream2_get_le16(gb);
253 segments = bytestream2_get_le16u(gb);
254 while ((segments & 0xC000) == 0xC000) {
255 unsigned skip_lines = -(int16_t)segments;
261 segments = bytestream2_get_le16(gb);
266 if (segments & 0x8000) {
268 segments = bytestream2_get_le16(gb);
276 if (
frame - line_ptr <= bytestream2_peek_byte(gb))
278 line_ptr += bytestream2_get_byte(gb);
279 count = (int8_t)bytestream2_get_byte(gb);
281 if (
frame - line_ptr < count * 2)
285 line_ptr += count * 2;
288 if (
frame - line_ptr < count * 2)
290 v = bytestream2_get_le16(gb);
291 for (
i = 0;
i < count;
i++)
292 bytestream_put_le16(&line_ptr, v);
303 uint32_t segments = bytestream2_get_le32(gb);
309 copy = bytestream2_get_byteu(gb) * 2;
310 skip = bytestream2_get_byteu(gb) * 2;
337 "COPY",
"TSW1",
"BDLT",
"WDLT",
"TDLT",
"DSW1",
"BLCK",
"DDS1"
345 const uint8_t *buf = avpkt->
data;
346 uint32_t chunk_type, chunk_size;
360 chunk_size = bytestream2_get_le32(&gb);
361 chunk_type = bytestream2_get_le32(&gb);
364 if (chunk_type == 1) {
365 pal_elems =
FFMIN(chunk_size / 3, 256);
366 for (
i = 0;
i < pal_elems;
i++) {
367 s->pal[
i] = bytestream2_get_be24(&gb) << 2;
368 s->pal[
i] |= 0xFFU << 24 | (
s->pal[
i] >> 6) & 0x30303;
370 }
else if (chunk_type <= 9) {
378 "Ignoring unknown chunk type %"PRIu32
"\n",
389 const uint8_t *buf1 = buf + (
i&3)*(avctx->
width/4) + (
i/4)*avctx->
width;
391 for(j = 0; j < avctx->
width/4; j++) {
398 for(; j < avctx->
width; j++) {
407 memcpy(
frame->data[1],
s->pal,
sizeof(
s->pal));
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
const FFCodec ff_dfa_decoder
static av_cold void close(AVCodecParserContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert0(cond)
assert() equivalent, that is always enabled.
Libavcodec external API header.
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
static av_always_inline int bytestream2_get_bytes_left(const 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)
#define i(width, name, range_min, range_max)
#define FF_CODEC_DECODE_CB(func)
#define CODEC_LONG_NAME(str)
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
int(* init)(AVBSFContext *ctx)
#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_WARNING
Something somehow does not look correct.
#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.
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
Check if the given dimension of an image is valid, meaning that all bytes of the image can be address...
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 int decode_dsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
static int dfa_decode_frame(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacket *avpkt)
int(* chunk_decoder)(GetByteContext *gb, uint8_t *frame, int width, int height)
static int decode_bdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
static const char chunk_name[8][5]
static int decode_tsw1(GetByteContext *gb, uint8_t *frame, int width, int height)
static const chunk_decoder decoder[8]
static int decode_dds1(GetByteContext *gb, uint8_t *frame, int width, int height)
static av_cold int dfa_decode_init(AVCodecContext *avctx)
static int decode_tdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
static av_cold int dfa_decode_end(AVCodecContext *avctx)
static int decode_wdlt(GetByteContext *gb, uint8_t *frame, int width, int height)
static int decode_copy(GetByteContext *gb, uint8_t *frame, int width, int height)
static int decode_blck(GetByteContext *gb, uint8_t *frame, int width, int height)
static const uint16_t mask[17]
Memory handling functions.
static void frame_start(MPVMainEncContext *const m)
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
main external API structure.
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
int width
picture width / height.
uint8_t * extradata
Out-of-band global headers that may be used by some codecs.
This structure describes decoded (raw) audio or video data.
This structure stores compressed data.
static int64_t frame_end(const SyncQueue *sq, SyncQueueFrame frame, int nb_samples)
Compute the end timestamp of a frame.
static void copy(const float *p1, float *p2, const int length)