avcodec/iff: Reindent after the previous commits
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -206,7 +206,7 @@ static int extract_header(AVCodecContext *const avctx,
|
|||||||
IffContext *s = avctx->priv_data;
|
IffContext *s = avctx->priv_data;
|
||||||
const uint8_t *buf = extradata;
|
const uint8_t *buf = extradata;
|
||||||
unsigned buf_size = 0;
|
unsigned buf_size = 0;
|
||||||
int i, palette_size;
|
int palette_size;
|
||||||
|
|
||||||
if (extradata_size < 2) {
|
if (extradata_size < 2) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "not enough extradata\n");
|
av_log(avctx, AV_LOG_ERROR, "not enough extradata\n");
|
||||||
@@ -231,7 +231,7 @@ static int extract_header(AVCodecContext *const avctx,
|
|||||||
s->flags = bytestream_get_byte(&buf);
|
s->flags = bytestream_get_byte(&buf);
|
||||||
s->transparency = bytestream_get_be16(&buf);
|
s->transparency = bytestream_get_be16(&buf);
|
||||||
s->masking = bytestream_get_byte(&buf);
|
s->masking = bytestream_get_byte(&buf);
|
||||||
for (i = 0; i < 16; i++)
|
for (int i = 0; i < 16; i++)
|
||||||
s->tvdc[i] = bytestream_get_be16(&buf);
|
s->tvdc[i] = bytestream_get_be16(&buf);
|
||||||
|
|
||||||
if (s->ham) {
|
if (s->ham) {
|
||||||
@@ -271,7 +271,7 @@ static int extract_header(AVCodecContext *const avctx,
|
|||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
if (s->ham) {
|
if (s->ham) {
|
||||||
int i, count = FFMIN(palette_size / 3, 1 << s->ham);
|
int count = FFMIN(palette_size / 3, 1 << s->ham);
|
||||||
int ham_count;
|
int ham_count;
|
||||||
const uint8_t *const palette = extradata + AV_RB16(extradata);
|
const uint8_t *const palette = extradata + AV_RB16(extradata);
|
||||||
int extra_space = 1;
|
int extra_space = 1;
|
||||||
@@ -291,18 +291,18 @@ static int extract_header(AVCodecContext *const avctx,
|
|||||||
if (count) { // HAM with color palette attached
|
if (count) { // HAM with color palette attached
|
||||||
// prefill with black and palette and set HAM take direct value mask to zero
|
// prefill with black and palette and set HAM take direct value mask to zero
|
||||||
memset(s->ham_palbuf, 0, (1 << s->ham) * 2 * sizeof (uint32_t));
|
memset(s->ham_palbuf, 0, (1 << s->ham) * 2 * sizeof (uint32_t));
|
||||||
for (i=0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
s->ham_palbuf[i*2+1] = 0xFF000000 | AV_RL24(palette + i*3);
|
s->ham_palbuf[i*2+1] = 0xFF000000 | AV_RL24(palette + i*3);
|
||||||
}
|
}
|
||||||
count = 1 << s->ham;
|
count = 1 << s->ham;
|
||||||
} else { // HAM with grayscale color palette
|
} else { // HAM with grayscale color palette
|
||||||
count = 1 << s->ham;
|
count = 1 << s->ham;
|
||||||
for (i=0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
s->ham_palbuf[i*2] = 0xFF000000; // take direct color value from palette
|
s->ham_palbuf[i*2] = 0xFF000000; // take direct color value from palette
|
||||||
s->ham_palbuf[i*2+1] = 0xFF000000 | av_le2ne32(gray2rgb((i * 255) >> s->ham));
|
s->ham_palbuf[i*2+1] = 0xFF000000 | av_le2ne32(gray2rgb((i * 255) >> s->ham));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
uint32_t tmp = i << (8 - s->ham);
|
uint32_t tmp = i << (8 - s->ham);
|
||||||
tmp |= tmp >> s->ham;
|
tmp |= tmp >> s->ham;
|
||||||
s->ham_palbuf[(i+count)*2] = 0xFF00FFFF; // just modify blue color component
|
s->ham_palbuf[(i+count)*2] = 0xFF00FFFF; // just modify blue color component
|
||||||
@@ -313,7 +313,7 @@ static int extract_header(AVCodecContext *const avctx,
|
|||||||
s->ham_palbuf[(i+count*3)*2+1] = 0xFF000000 | tmp << 8;
|
s->ham_palbuf[(i+count*3)*2+1] = 0xFF000000 | tmp << 8;
|
||||||
}
|
}
|
||||||
if (s->masking == MASK_HAS_MASK) {
|
if (s->masking == MASK_HAS_MASK) {
|
||||||
for (i = 0; i < ham_count; i++)
|
for (int i = 0; i < ham_count; i++)
|
||||||
s->ham_palbuf[(1 << s->bpp) + i] = s->ham_palbuf[i] | 0xFF000000;
|
s->ham_palbuf[(1 << s->bpp) + i] = s->ham_palbuf[i] | 0xFF000000;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1469,18 +1469,14 @@ static int parse_packet_header(AVCodecContext *const avctx,
|
|||||||
GetByteContext *gb)
|
GetByteContext *gb)
|
||||||
{
|
{
|
||||||
IffContext *s = avctx->priv_data;
|
IffContext *s = avctx->priv_data;
|
||||||
int i;
|
|
||||||
|
|
||||||
uint32_t chunk_id;
|
|
||||||
uint64_t data_size;
|
|
||||||
|
|
||||||
if (avctx->codec_tag != MKTAG('A', 'N', 'I', 'M'))
|
if (avctx->codec_tag != MKTAG('A', 'N', 'I', 'M'))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
bytestream2_skip(gb, 4);
|
bytestream2_skip(gb, 4);
|
||||||
while (bytestream2_get_bytes_left(gb) >= 1) {
|
while (bytestream2_get_bytes_left(gb) >= 1) {
|
||||||
chunk_id = bytestream2_get_le32(gb);
|
uint32_t chunk_id = bytestream2_get_le32(gb);
|
||||||
data_size = bytestream2_get_be32(gb);
|
uint64_t data_size = bytestream2_get_be32(gb);
|
||||||
|
|
||||||
if (chunk_id == MKTAG('B', 'M', 'H', 'D')) {
|
if (chunk_id == MKTAG('B', 'M', 'H', 'D')) {
|
||||||
bytestream2_skip(gb, data_size + (data_size & 1));
|
bytestream2_skip(gb, data_size + (data_size & 1));
|
||||||
@@ -1509,10 +1505,10 @@ static int parse_packet_header(AVCodecContext *const avctx,
|
|||||||
if (count > 256)
|
if (count > 256)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
if (s->ham) {
|
if (s->ham) {
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
pal[i] = 0xFF000000 | bytestream2_get_le24(gb);
|
pal[i] = 0xFF000000 | bytestream2_get_le24(gb);
|
||||||
} else {
|
} else {
|
||||||
for (i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
pal[i] = 0xFF000000 | bytestream2_get_be24(gb);
|
pal[i] = 0xFF000000 | bytestream2_get_be24(gb);
|
||||||
}
|
}
|
||||||
bytestream2_skip(gb, data_size & 1);
|
bytestream2_skip(gb, data_size & 1);
|
||||||
|
Reference in New Issue
Block a user