FFmpeg  4.4.6
sga.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021 Paul B Mahol
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/common.h"
23 #include "avcodec.h"
24 #include "get_bits.h"
25 #include "bytestream.h"
26 #include "internal.h"
27 
28 #define PALDATA_FOLLOWS_TILEDATA 4
29 #define HAVE_COMPRESSED_TILEMAP 32
30 #define HAVE_TILEMAP 128
31 
32 typedef struct SGAVideoContext {
34 
44 
45  int flags;
46  int nb_pal;
47  int nb_tiles;
49  int shift;
50  int plus;
51  int swap;
52 
53  uint32_t pal[256];
55  unsigned tileindex_size;
57  unsigned palmapindex_size;
60 
62 {
63  avctx->pix_fmt = AV_PIX_FMT_PAL8;
64  return 0;
65 }
66 
67 static int decode_palette(GetByteContext *gb, uint32_t *pal)
68 {
69  GetBitContext gbit;
70 
71  if (bytestream2_get_bytes_left(gb) < 18)
72  return AVERROR_INVALIDDATA;
73 
74  memset(pal, 0, 16 * sizeof(*pal));
75  (void)init_get_bits8(&gbit, gb->buffer, 18);
76 
77  for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
78  for (int index = 0; index < 16; index++) {
79  unsigned color = get_bits1(&gbit) << RGBIndex;
80  pal[15 - index] |= color << (5 + 16);
81  }
82  }
83 
84  for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
85  for (int index = 0; index < 16; index++) {
86  unsigned color = get_bits1(&gbit) << RGBIndex;
87  pal[15 - index] |= color << (5 + 8);
88  }
89  }
90 
91  for (int RGBIndex = 0; RGBIndex < 3; RGBIndex++) {
92  for (int index = 0; index < 16; index++) {
93  unsigned color = get_bits1(&gbit) << RGBIndex;
94  pal[15 - index] |= color << (5 + 0);
95  }
96  }
97 
98  for (int index = 0; index < 16; index++)
99  pal[index] = (0xFFU << 24) | pal[index] | (pal[index] >> 3);
100 
101  bytestream2_skip(gb, 18);
102 
103  return 0;
104 }
105 
107 {
108  const uint8_t *tt = s->tileindex_data;
109 
110  for (int y = 0; y < s->tiles_h; y++) {
111  for (int x = 0; x < s->tiles_w; x++) {
112  int pal_idx = s->palmapindex_data[y * s->tiles_w + x] * 16;
113  uint8_t *dst = frame->data[0] + y * 8 * frame->linesize[0] + x * 8;
114 
115  for (int yy = 0; yy < 8; yy++) {
116  for (int xx = 0; xx < 8; xx++)
117  dst[xx] = pal_idx + tt[xx];
118  tt += 8;
119 
120  dst += frame->linesize[0];
121  }
122  }
123  }
124 
125  return 0;
126 }
127 
129 {
130  GetByteContext *gb = &s->gb;
131  GetBitContext pm;
132 
133  bytestream2_seek(gb, s->tilemapdata_offset, SEEK_SET);
134  if (bytestream2_get_bytes_left(gb) < s->tilemapdata_size)
135  return AVERROR_INVALIDDATA;
136 
137  init_get_bits8(&pm, gb->buffer, s->tilemapdata_size);
138 
139  for (int y = 0; y < s->tiles_h; y++) {
140  for (int x = 0; x < s->tiles_w; x++) {
141  uint8_t tile[64];
142  int tilemap = get_bits(&pm, 16);
143  int flip_x = (tilemap >> 11) & 1;
144  int flip_y = (tilemap >> 12) & 1;
145  int tindex = av_clip((tilemap & 511) - 1, 0, s->nb_tiles - 1);
146  const uint8_t *tt = s->tileindex_data + tindex * 64;
147  int pal_idx = ((tilemap >> 13) & 3) * 16;
148  uint8_t *dst = frame->data[0] + y * 8 * frame->linesize[0] + x * 8;
149 
150  if (!flip_x && !flip_y) {
151  memcpy(tile, tt, 64);
152  } else if (flip_x && flip_y) {
153  for (int i = 0; i < 8; i++) {
154  for (int j = 0; j < 8; j++)
155  tile[i * 8 + j] = tt[(7 - i) * 8 + 7 - j];
156  }
157  } else if (flip_x) {
158  for (int i = 0; i < 8; i++) {
159  for (int j = 0; j < 8; j++)
160  tile[i * 8 + j] = tt[i * 8 + 7 - j];
161  }
162  } else {
163  for (int i = 0; i < 8; i++) {
164  for (int j = 0; j < 8; j++)
165  tile[i * 8 + j] = tt[(7 - i) * 8 + j];
166  }
167  }
168 
169  for (int yy = 0; yy < 8; yy++) {
170  for (int xx = 0; xx < 8; xx++)
171  dst[xx] = pal_idx + tile[xx + yy * 8];
172 
173  dst += frame->linesize[0];
174  }
175  }
176  }
177 
178  return 0;
179 }
180 
182 {
183  const uint8_t *src = s->tileindex_data;
184  uint8_t *dst = frame->data[0];
185 
186  for (int y = 0; y < frame->height; y += 8) {
187  for (int x = 0; x < frame->width; x += 8) {
188  for (int yy = 0; yy < 8; yy++) {
189  for (int xx = 0; xx < 8; xx++)
190  dst[x + xx + yy * frame->linesize[0]] = src[xx];
191  src += 8;
192  }
193  }
194 
195  dst += 8 * frame->linesize[0];
196  }
197 
198  return 0;
199 }
200 
201 static int lzss_decompress(AVCodecContext *avctx,
202  GetByteContext *gb, uint8_t *dst,
203  int dst_size, int shift, int plus)
204 {
205  int oi = 0;
206 
207  while (bytestream2_get_bytes_left(gb) > 0 && oi < dst_size) {
208  uint16_t displace, header = bytestream2_get_be16(gb);
209  int count, offset;
210 
211  for (int i = 0; i < 16; i++) {
212  switch (header >> 15) {
213  case 0:
214  if (oi + 2 < dst_size) {
215  dst[oi++] = bytestream2_get_byte(gb);
216  dst[oi++] = bytestream2_get_byte(gb);
217  }
218  break;
219  case 1:
220  displace = bytestream2_get_be16(gb);
221  count = displace >> shift;
222  offset = displace & ((1 << shift) - 1);
223 
224  if (displace == 0) {
225  while (bytestream2_get_bytes_left(gb) > 0 &&
226  oi < dst_size)
227  dst[oi++] = bytestream2_get_byte(gb);
228  return oi;
229  }
230 
231  count += plus;
232 
233  if (offset <= 0)
234  offset = 1;
235  if (oi < offset || oi + count * 2 > dst_size)
236  return AVERROR_INVALIDDATA;
237  for (int j = 0; j < count * 2; j++) {
238  dst[oi] = dst[oi - offset];
239  oi++;
240  }
241  break;
242  }
243 
244  header <<= 1;
245  }
246  }
247 
248  return AVERROR_INVALIDDATA;
249 }
250 
252 {
253  SGAVideoContext *s = avctx->priv_data;
254  const int bits = (s->nb_pal + 1) / 2;
255  GetByteContext *gb = &s->gb;
256  GetBitContext pm;
257  int ret;
258 
259  bytestream2_seek(gb, s->palmapdata_offset, SEEK_SET);
260  if (bytestream2_get_bytes_left(gb) < s->palmapdata_size)
261  return AVERROR_INVALIDDATA;
262  ret = init_get_bits8(&pm, gb->buffer, s->palmapdata_size);
263  av_assert1(ret >= 0);
264 
265  for (int y = 0; y < s->tiles_h; y++) {
266  uint8_t *dst = s->palmapindex_data + y * s->tiles_w;
267 
268  for (int x = 0; x < s->tiles_w; x++)
269  dst[x] = get_bits(&pm, bits);
270 
271  dst += s->tiles_w;
272  }
273 
274  return 0;
275 }
276 
277 static int decode_tiledata(AVCodecContext *avctx)
278 {
279  SGAVideoContext *s = avctx->priv_data;
280  GetByteContext *gb = &s->gb;
281  GetBitContext tm;
282  int ret;
283 
284  bytestream2_seek(gb, s->tiledata_offset, SEEK_SET);
285  if (bytestream2_get_bytes_left(gb) < s->tiledata_size)
286  return AVERROR_INVALIDDATA;
287  ret = init_get_bits8(&tm, gb->buffer, s->tiledata_size);
288  av_assert1(ret >= 0);
289 
290  for (int n = 0; n < s->nb_tiles; n++) {
291  uint8_t *dst = s->tileindex_data + n * 64;
292 
293  for (int yy = 0; yy < 8; yy++) {
294  for (int xx = 0; xx < 8; xx++)
295  dst[xx] = get_bits(&tm, 4);
296 
297  dst += 8;
298  }
299  }
300 
301  for (int i = 0; i < s->nb_tiles && s->swap; i++) {
302  uint8_t *dst = s->tileindex_data + i * 64;
303 
304  for (int j = 8; j < 64; j += 16) {
305  for (int k = 0; k < 8; k += 2)
306  FFSWAP(uint8_t, dst[j + k], dst[j+k+1]);
307  }
308  }
309 
310  return 0;
311 }
312 
313 static int sga_decode_frame(AVCodecContext *avctx, void *data,
314  int *got_frame, AVPacket *avpkt)
315 {
316  SGAVideoContext *s = avctx->priv_data;
317  GetByteContext *gb = &s->gb;
318  AVFrame *frame = data;
319  int ret, type;
320 
321  if (avpkt->size <= 14)
322  return AVERROR_INVALIDDATA;
323 
324  s->flags = avpkt->data[8];
325  s->nb_pal = avpkt->data[9];
326  s->tiles_w = avpkt->data[10];
327  s->tiles_h = avpkt->data[11];
328 
329  if (s->nb_pal > 4)
330  return AVERROR_INVALIDDATA;
331 
332  if ((ret = ff_set_dimensions(avctx,
333  s->tiles_w * 8,
334  s->tiles_h * 8)) < 0)
335  return ret;
336 
337  av_fast_padded_malloc(&s->tileindex_data, &s->tileindex_size,
338  avctx->width * avctx->height);
339  if (!s->tileindex_data)
340  return AVERROR(ENOMEM);
341 
342  av_fast_padded_malloc(&s->palmapindex_data, &s->palmapindex_size,
343  s->tiles_w * s->tiles_h);
344  if (!s->palmapindex_data)
345  return AVERROR(ENOMEM);
346 
347  if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
348  return ret;
349 
350  bytestream2_init(gb, avpkt->data, avpkt->size);
351 
352  type = bytestream2_get_byte(gb);
353  s->metadata_size = 12 + ((!!(s->flags & HAVE_TILEMAP)) * 2);
354  s->nb_tiles = s->flags & HAVE_TILEMAP ? AV_RB16(avpkt->data + 12) : s->tiles_w * s->tiles_h;
355  if (s->nb_tiles > s->tiles_w * s->tiles_h)
356  return AVERROR_INVALIDDATA;
357 
358  av_log(avctx, AV_LOG_DEBUG, "type: %X flags: %X nb_tiles: %d\n", type, s->flags, s->nb_tiles);
359 
360  switch (type) {
361  case 0xE7:
362  case 0xCB:
363  case 0xCD:
364  s->swap = 1;
365  s->shift = 12;
366  s->plus = 1;
367  break;
368  case 0xC9:
369  s->swap = 1;
370  s->shift = 13;
371  s->plus = 1;
372  break;
373  case 0xC8:
374  s->swap = 1;
375  s->shift = 13;
376  s->plus = 0;
377  break;
378  case 0xC7:
379  s->swap = 0;
380  s->shift = 13;
381  s->plus = 1;
382  break;
383  case 0xC6:
384  s->swap = 0;
385  s->shift = 13;
386  s->plus = 0;
387  break;
388  }
389 
390  if (type == 0xE7) {
391  int offset = s->metadata_size, left;
392  int sizes[3];
393 
394  bytestream2_seek(gb, s->metadata_size, SEEK_SET);
395 
396  for (int i = 0; i < 3; i++)
397  sizes[i] = bytestream2_get_be16(gb);
398 
399  for (int i = 0; i < 3; i++) {
400  int size = sizes[i];
401  int raw = size >> 15;
402 
403  size &= (1 << 15) - 1;
404 
405  if (raw) {
407  return AVERROR_INVALIDDATA;
408 
409  if (sizeof(s->uncompressed) - offset < size)
410  return AVERROR_INVALIDDATA;
411 
412  memcpy(s->uncompressed + offset, gb->buffer, size);
413  bytestream2_skip(gb, size);
414  } else {
415  GetByteContext gb2;
416 
418  return AVERROR_INVALIDDATA;
419 
420  bytestream2_init(&gb2, gb->buffer, size);
421  ret = lzss_decompress(avctx, &gb2, s->uncompressed + offset,
422  sizeof(s->uncompressed) - offset, s->shift, s->plus);
423  if (ret < 0)
424  return ret;
425  bytestream2_skip(gb, size);
426  size = ret;
427  }
428 
429  offset += size;
430  }
431 
432  left = bytestream2_get_bytes_left(gb);
433  if (sizeof(s->uncompressed) - offset < left)
434  return AVERROR_INVALIDDATA;
435 
436  bytestream2_get_buffer(gb, s->uncompressed + offset, left);
437 
438  offset += left;
439  bytestream2_init(gb, s->uncompressed, offset);
440  }
441 
442  switch (type) {
443  case 0xCD:
444  case 0xCB:
445  case 0xC9:
446  case 0xC8:
447  case 0xC7:
448  case 0xC6:
449  bytestream2_seek(gb, s->metadata_size, SEEK_SET);
450  ret = lzss_decompress(avctx, gb, s->uncompressed + s->metadata_size,
451  sizeof(s->uncompressed) - s->metadata_size, s->shift, s->plus);
452  if (ret < 0)
453  return ret;
454  bytestream2_init(gb, s->uncompressed, ret + s->metadata_size);
455  case 0xE7:
456  case 0xC1:
457  s->tiledata_size = s->nb_tiles * 32;
458  s->paldata_size = s->nb_pal * 18;
459  s->tiledata_offset = s->flags & PALDATA_FOLLOWS_TILEDATA ? s->metadata_size : s->metadata_size + s->paldata_size;
460  s->paldata_offset = s->flags & PALDATA_FOLLOWS_TILEDATA ? s->metadata_size + s->tiledata_size : s->metadata_size;
461  s->palmapdata_offset = (s->flags & HAVE_TILEMAP) ? -1 : s->paldata_offset + s->paldata_size;
462  s->palmapdata_size = (s->flags & HAVE_TILEMAP) || s->nb_pal < 2 ? 0 : (s->tiles_w * s->tiles_h * ((s->nb_pal + 1) / 2) + 7) / 8;
463  s->tilemapdata_size = (s->flags & HAVE_TILEMAP) ? s->tiles_w * s->tiles_h * 2 : 0;
464  s->tilemapdata_offset = (s->flags & HAVE_TILEMAP) ? s->paldata_offset + s->paldata_size: -1;
465 
466  bytestream2_seek(gb, s->paldata_offset, SEEK_SET);
467  for (int n = 0; n < s->nb_pal; n++) {
468  ret = decode_palette(gb, s->pal + 16 * n);
469  if (ret < 0)
470  return ret;
471  }
472 
473  if (s->tiledata_size > 0) {
474  ret = decode_tiledata(avctx);
475  if (ret < 0)
476  return ret;
477  }
478 
479  if (s->palmapdata_size > 0) {
480  ret = decode_palmapdata(avctx);
481  if (ret < 0)
482  return ret;
483  }
484 
485  if (s->palmapdata_size > 0 && s->tiledata_size > 0) {
486  ret = decode_index_palmap(s, frame);
487  if (ret < 0)
488  return ret;
489  } else if (s->tilemapdata_size > 0 && s->tiledata_size > 0) {
490  ret = decode_index_tilemap(s, frame);
491  if (ret < 0)
492  return ret;
493  } else if (s->tiledata_size > 0) {
494  ret = decode_index(s, frame);
495  if (ret < 0)
496  return ret;
497  }
498  break;
499  default:
500  av_log(avctx, AV_LOG_ERROR, "Unknown type: %X\n", type);
501  return AVERROR_INVALIDDATA;
502  }
503 
504  memcpy(frame->data[1], s->pal, AVPALETTE_SIZE);
507  frame->key_frame = 1;
508 
509  *got_frame = 1;
510 
511  return avpkt->size;
512 }
513 
515 {
516  SGAVideoContext *s = avctx->priv_data;
517 
518  av_freep(&s->tileindex_data);
519  s->tileindex_size = 0;
520 
521  av_freep(&s->palmapindex_data);
522  s->palmapindex_size = 0;
523 
524  return 0;
525 }
526 
528  .name = "sga",
529  .long_name = NULL_IF_CONFIG_SMALL("Digital Pictures SGA Video"),
530  .type = AVMEDIA_TYPE_VIDEO,
531  .id = AV_CODEC_ID_SGA_VIDEO,
532  .priv_data_size = sizeof(SGAVideoContext),
535  .close = sga_decode_end,
536  .capabilities = AV_CODEC_CAP_DR1,
537  .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
538 };
#define av_cold
Definition: attributes.h:88
uint8_t
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
Libavcodec external API header.
#define AV_RB16
Definition: intreadwrite.h:53
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:267
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:168
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:212
#define s(width, name)
Definition: cbs_vp9.c:257
common internal and external API header
#define FFSWAP(type, a, b)
Definition: common.h:108
#define av_clip
Definition: common.h:122
int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
Get a buffer for a frame.
Definition: decode.c:1900
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
static AVFrame * frame
bitstream reader API header.
static unsigned int get_bits1(GetBitContext *s)
Definition: get_bits.h:498
static int init_get_bits8(GetBitContext *s, const uint8_t *buffer, int byte_size)
Initialize GetBitContext.
Definition: get_bits.h:677
static unsigned int get_bits(GetBitContext *s, int n)
Read 1-25 bits.
Definition: get_bits.h:379
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
@ AV_CODEC_ID_SGA_VIDEO
Definition: codec_id.h:309
void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size)
Same behaviour av_fast_malloc but the buffer has additional AV_INPUT_BUFFER_PADDING_SIZE at the end w...
Definition: utils.c:50
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:59
#define AVERROR(e)
Definition: error.h:43
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:215
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:194
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
@ AV_PICTURE_TYPE_I
Intra.
Definition: avutil.h:274
int index
Definition: gxfenc.c:89
cl_device_type type
static const int sizes[][2]
Definition: img2dec.c:54
int i
Definition: input.c:407
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:41
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.
Definition: utils.c:84
static int decode_palmapdata(AVCodecContext *avctx)
Definition: sga.c:251
static av_cold int sga_decode_end(AVCodecContext *avctx)
Definition: sga.c:514
static int decode_index_tilemap(SGAVideoContext *s, AVFrame *frame)
Definition: sga.c:128
#define HAVE_TILEMAP
Definition: sga.c:30
static av_cold int sga_decode_init(AVCodecContext *avctx)
Definition: sga.c:61
static int decode_index_palmap(SGAVideoContext *s, AVFrame *frame)
Definition: sga.c:106
static int lzss_decompress(AVCodecContext *avctx, GetByteContext *gb, uint8_t *dst, int dst_size, int shift, int plus)
Definition: sga.c:201
static int decode_palette(GetByteContext *gb, uint32_t *pal)
Definition: sga.c:67
static int decode_index(SGAVideoContext *s, AVFrame *frame)
Definition: sga.c:181
static int sga_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt)
Definition: sga.c:313
static int decode_tiledata(AVCodecContext *avctx)
Definition: sga.c:277
AVCodec ff_sga_decoder
Definition: sga.c:527
#define PALDATA_FOLLOWS_TILEDATA
Definition: sga.c:28
common internal API header
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
const char data[16]
Definition: mxf.c:142
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
#define AVPALETTE_SIZE
Definition: pixfmt.h:32
typedef void(RENAME(mix_any_func_type))
static const uint8_t header[24]
Definition: sdr2.c:67
static int shift(int a, int b)
Definition: sonic.c:82
main external API structure.
Definition: avcodec.h:536
enum AVPixelFormat pix_fmt
Pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:746
int width
picture width / height.
Definition: avcodec.h:709
void * priv_data
Definition: avcodec.h:563
AVCodec.
Definition: codec.h:197
const char * name
Name of the codec implementation.
Definition: codec.h:204
This structure describes decoded (raw) audio or video data.
Definition: frame.h:318
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:332
int width
Definition: frame.h:376
int key_frame
1 -> keyframe, 0-> not
Definition: frame.h:396
int height
Definition: frame.h:376
int palette_has_changed
Tell user application that palette has changed from previous frame.
Definition: frame.h:475
int linesize[AV_NUM_DATA_POINTERS]
For video, size in bytes of each picture line.
Definition: frame.h:349
enum AVPictureType pict_type
Picture type of the frame.
Definition: frame.h:401
This structure stores compressed data.
Definition: packet.h:346
int size
Definition: packet.h:370
uint8_t * data
Definition: packet.h:369
const uint8_t * buffer
Definition: bytestream.h:34
int tilemapdata_offset
Definition: sga.c:39
int nb_tiles
Definition: sga.c:47
int palmapdata_size
Definition: sga.c:43
int tiles_w
Definition: sga.c:48
int shift
Definition: sga.c:49
uint32_t pal[256]
Definition: sga.c:53
int tilemapdata_size
Definition: sga.c:38
int nb_pal
Definition: sga.c:46
unsigned tileindex_size
Definition: sga.c:55
int tiledata_offset
Definition: sga.c:37
uint8_t * tileindex_data
Definition: sga.c:54
GetByteContext gb
Definition: sga.c:33
int tiles_h
Definition: sga.c:48
uint8_t uncompressed[65536]
Definition: sga.c:58
int tiledata_size
Definition: sga.c:36
int palmapdata_offset
Definition: sga.c:42
unsigned palmapindex_size
Definition: sga.c:57
int paldata_offset
Definition: sga.c:41
int metadata_size
Definition: sga.c:35
int plus
Definition: sga.c:50
int swap
Definition: sga.c:51
int paldata_size
Definition: sga.c:40
int flags
Definition: sga.c:45
uint8_t * palmapindex_data
Definition: sga.c:56
#define av_freep(p)
#define av_log(a,...)
#define src
Definition: vp8dsp.c:255
int size
static const uint8_t offset[127][2]
Definition: vf_spp.c:107
uint8_t bits
Definition: vp3data.h:141