loco: cosmetics, reformat

This commit is contained in:
Anton Khirnov 2012-11-19 18:48:15 +01:00
parent 1a31dff937
commit b627c3010b
1 changed files with 47 additions and 31 deletions

View File

@ -30,8 +30,18 @@
#include "internal.h"
#include "mathops.h"
enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5};
enum LOCO_MODE {
LOCO_UNKN = 0,
LOCO_CYUY2 = -1,
LOCO_CRGB = -2,
LOCO_CRGBA = -3,
LOCO_CYV12 = -4,
LOCO_YUY2 = 1,
LOCO_UYVY = 2,
LOCO_RGB = 3,
LOCO_RGBA = 4,
LOCO_YV12 = 5,
};
typedef struct LOCOContext {
AVCodecContext *avctx;
@ -88,8 +98,7 @@ static inline int loco_get_rice(RICEContext *r)
r->save += r->run + 1;
else
r->save -= 3;
}
else
} else
r->run2++;
} else {
v = ((v >> 1) + r->lossy) ^ -(v & 1);
@ -161,9 +170,9 @@ static int decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
LOCOContext * const l = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
LOCOContext * const l = avctx->priv_data;
AVFrame * const p = &l->pic;
int decoded, ret;
@ -229,7 +238,8 @@ static int decode_frame(AVCodecContext *avctx,
return buf_size;
}
static av_cold int decode_init(AVCodecContext *avctx){
static av_cold int decode_init(AVCodecContext *avctx)
{
LOCOContext * const l = avctx->priv_data;
int version;
@ -254,16 +264,21 @@ static av_cold int decode_init(AVCodecContext *avctx){
l->mode = AV_RL32(avctx->extradata + 4);
switch (l->mode) {
case LOCO_CYUY2: case LOCO_YUY2: case LOCO_UYVY:
case LOCO_CYUY2:
case LOCO_YUY2:
case LOCO_UYVY:
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
break;
case LOCO_CRGB: case LOCO_RGB:
case LOCO_CRGB:
case LOCO_RGB:
avctx->pix_fmt = AV_PIX_FMT_BGR24;
break;
case LOCO_CYV12: case LOCO_YV12:
case LOCO_CYV12:
case LOCO_YV12:
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
break;
case LOCO_CRGBA: case LOCO_RGBA:
case LOCO_CRGBA:
case LOCO_RGBA:
avctx->pix_fmt = AV_PIX_FMT_RGB32;
break;
default:
@ -276,7 +291,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
return 0;
}
static av_cold int decode_end(AVCodecContext *avctx){
static av_cold int decode_end(AVCodecContext *avctx)
{
LOCOContext * const l = avctx->priv_data;
AVFrame *pic = &l->pic;