33 int tmp,
bit_depth, color_table_id, greyscale, i;
39 bit_depth = tmp & 0x1F;
40 greyscale = tmp & 0x20;
50 if ((bit_depth == 1 || bit_depth == 2 || bit_depth == 4 || bit_depth == 8)) {
51 uint32_t color_count, color_start, color_end;
56 if (greyscale && bit_depth > 1 && color_table_id) {
57 int color_index, color_dec;
61 color_dec = 256 / (color_count - 1);
62 for (i = 0; i < color_count; i++) {
63 r = g = b = color_index;
64 palette[i] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
65 color_index -= color_dec;
69 }
else if (color_table_id) {
77 else if (bit_depth == 2)
79 else if (bit_depth == 4)
83 for (i = 0; i < color_count; i++) {
84 r = color_table[i * 3 + 0];
85 g = color_table[i * 3 + 1];
86 b = color_table[i * 3 + 2];
87 palette[i] = (0xFF
U << 24) | (r << 16) | (g << 8) | (b);
95 if ((color_start <= 255) && (color_end <= 255)) {
96 for (i = color_start; i <= color_end; i++) {
107 palette[i] = (a << 24 ) | (r << 16) | (g << 8) | (b);
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
static const uint8_t ff_qt_default_palette_256[256 *3]
unsigned int avio_rb16(AVIOContext *s)
unsigned int avio_rb32(AVIOContext *s)
static const uint8_t ff_qt_default_palette_4[4 *3]
int avio_r8(AVIOContext *s)
int ff_get_qtpalette(int codec_id, AVIOContext *pb, uint32_t *palette)
Retrieve the palette (or "color table" in QuickTime terms), either from the video sample description...
static const struct ColorTable color_table[][8]
static const uint8_t ff_qt_default_palette_16[16 *3]
static unsigned bit_depth(uint64_t mask)
static const uint8_t ff_qt_default_palette_2[2 *3]