1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-20 07:48:15 +02:00

avcodec/targa: Fix indentation

Forgotten after 1e85a698c01133a7f8d35502d5901e3b65fa3317.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2022-08-25 02:45:27 +02:00
parent 5714cf1b5b
commit 91ba3f5a8f

View File

@ -253,49 +253,48 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
} }
} }
if (compr & TGA_RLE) { if (compr & TGA_RLE) {
int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave); int res = targa_decode_rle(avctx, s, dst, w, h, stride, bpp, interleave);
if (res < 0) if (res < 0)
return res; return res;
} else { } else {
uint8_t *line; uint8_t *line;
if (bytestream2_get_bytes_left(&s->gb) < img_size * h) { if (bytestream2_get_bytes_left(&s->gb) < img_size * h) {
av_log(avctx, AV_LOG_ERROR, av_log(avctx, AV_LOG_ERROR,
"Not enough data available for image\n"); "Not enough data available for image\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
}
line = dst;
y = 0;
do {
bytestream2_get_buffer(&s->gb, line, img_size);
line = advance_line(dst, line, stride, &y, h, interleave);
} while (line);
} }
if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip line = dst;
int x; y = 0;
for (y = 0; y < h; y++) { do {
void *line = &p->data[0][y * p->linesize[0]]; bytestream2_get_buffer(&s->gb, line, img_size);
for (x = 0; x < w >> 1; x++) { line = advance_line(dst, line, stride, &y, h, interleave);
switch (bpp) { } while (line);
case 32: }
FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
break; if (flags & TGA_RIGHTTOLEFT) { // right-to-left, needs horizontal flip
case 24: for (int y = 0; y < h; y++) {
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * w - 3 * x - 3]); void *line = &p->data[0][y * p->linesize[0]];
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * w - 3 * x - 2]); for (int x = 0; x < w >> 1; x++) {
FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * w - 3 * x - 1]); switch (bpp) {
break; case 32:
case 16: FFSWAP(uint32_t, ((uint32_t *)line)[x], ((uint32_t *)line)[w - x - 1]);
FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[w - x - 1]); break;
break; case 24:
case 8: FFSWAP(uint8_t, ((uint8_t *)line)[3 * x ], ((uint8_t *)line)[3 * w - 3 * x - 3]);
FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[w - x - 1]); FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 1], ((uint8_t *)line)[3 * w - 3 * x - 2]);
} FFSWAP(uint8_t, ((uint8_t *)line)[3 * x + 2], ((uint8_t *)line)[3 * w - 3 * x - 1]);
break;
case 16:
FFSWAP(uint16_t, ((uint16_t *)line)[x], ((uint16_t *)line)[w - x - 1]);
break;
case 8:
FFSWAP(uint8_t, ((uint8_t *)line)[x], ((uint8_t *)line)[w - x - 1]);
} }
} }
} }
}
*got_frame = 1; *got_frame = 1;