Commit f7e30cc1 authored by Aneesh Dogra's avatar Aneesh Dogra Committed by Anton Khirnov

bfi: K&R cosmetics

Signed-off-by: 's avatarAnton Khirnov <anton@khirnov.net>
parent 87d98748
......@@ -36,7 +36,7 @@ typedef struct BFIContext {
uint8_t *dst;
} BFIContext;
static av_cold int bfi_decode_init(AVCodecContext * avctx)
static av_cold int bfi_decode_init(AVCodecContext *avctx)
{
BFIContext *bfi = avctx->priv_data;
avctx->pix_fmt = PIX_FMT_PAL8;
......@@ -44,7 +44,7 @@ static av_cold int bfi_decode_init(AVCodecContext * avctx)
return 0;
}
static int bfi_decode_frame(AVCodecContext * avctx, void *data,
static int bfi_decode_frame(AVCodecContext *avctx, void *data,
int *data_size, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data, *buf_end = avpkt->data + avpkt->size;
......@@ -71,11 +71,11 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi->frame.pict_type = AV_PICTURE_TYPE_I;
bfi->frame.key_frame = 1;
/* Setting the palette */
if(avctx->extradata_size>768) {
if (avctx->extradata_size > 768) {
av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n");
return -1;
}
pal = (uint32_t *) bfi->frame.data[1];
pal = (uint32_t *)bfi->frame.data[1];
for (i = 0; i < avctx->extradata_size / 3; i++) {
int shift = 16;
*pal = 0;
......@@ -91,16 +91,17 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
bfi->frame.key_frame = 0;
}
buf += 4; //Unpacked size, not required.
buf += 4; // Unpacked size, not required.
while (dst != frame_end) {
static const uint8_t lentab[4]={0,2,0,1};
unsigned int byte = *buf++, av_uninit(offset);
unsigned int code = byte >> 6;
static const uint8_t lentab[4] = { 0, 2, 0, 1 };
unsigned int byte = *buf++, av_uninit(offset);
unsigned int code = byte >> 6;
unsigned int length = byte & ~0xC0;
if (buf >= buf_end) {
av_log(avctx, AV_LOG_ERROR, "Input resolution larger than actual frame.\n");
av_log(avctx, AV_LOG_ERROR,
"Input resolution larger than actual frame.\n");
return -1;
}
......@@ -120,7 +121,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
}
/* Do boundary check */
if (dst + (length<<lentab[code]) > frame_end)
if (dst + (length << lentab[code]) > frame_end)
break;
switch (code) {
......@@ -167,7 +168,7 @@ static int bfi_decode_frame(AVCodecContext * avctx, void *data,
dst += bfi->frame.linesize[0];
}
*data_size = sizeof(AVFrame);
*(AVFrame *) data = bfi->frame;
*(AVFrame *)data = bfi->frame;
return buf_size;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment