You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-07-11 14:30:22 +02:00
loco: cosmetics, reformat
This commit is contained in:
@ -30,8 +30,18 @@
|
|||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
#include "mathops.h"
|
#include "mathops.h"
|
||||||
|
|
||||||
enum LOCO_MODE {LOCO_UNKN=0, LOCO_CYUY2=-1, LOCO_CRGB=-2, LOCO_CRGBA=-3, LOCO_CYV12=-4,
|
enum LOCO_MODE {
|
||||||
LOCO_YUY2=1, LOCO_UYVY=2, LOCO_RGB=3, LOCO_RGBA=4, LOCO_YV12=5};
|
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 {
|
typedef struct LOCOContext {
|
||||||
AVCodecContext *avctx;
|
AVCodecContext *avctx;
|
||||||
@ -88,8 +98,7 @@ static inline int loco_get_rice(RICEContext *r)
|
|||||||
r->save += r->run + 1;
|
r->save += r->run + 1;
|
||||||
else
|
else
|
||||||
r->save -= 3;
|
r->save -= 3;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
r->run2++;
|
r->run2++;
|
||||||
} else {
|
} else {
|
||||||
v = ((v >> 1) + r->lossy) ^ -(v & 1);
|
v = ((v >> 1) + r->lossy) ^ -(v & 1);
|
||||||
@ -161,9 +170,9 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
void *data, int *got_frame,
|
void *data, int *got_frame,
|
||||||
AVPacket *avpkt)
|
AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
|
LOCOContext * const l = avctx->priv_data;
|
||||||
const uint8_t *buf = avpkt->data;
|
const uint8_t *buf = avpkt->data;
|
||||||
int buf_size = avpkt->size;
|
int buf_size = avpkt->size;
|
||||||
LOCOContext * const l = avctx->priv_data;
|
|
||||||
AVFrame * const p = &l->pic;
|
AVFrame * const p = &l->pic;
|
||||||
int decoded, ret;
|
int decoded, ret;
|
||||||
|
|
||||||
@ -229,7 +238,8 @@ static int decode_frame(AVCodecContext *avctx,
|
|||||||
return buf_size;
|
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;
|
LOCOContext * const l = avctx->priv_data;
|
||||||
int version;
|
int version;
|
||||||
|
|
||||||
@ -254,16 +264,21 @@ static av_cold int decode_init(AVCodecContext *avctx){
|
|||||||
|
|
||||||
l->mode = AV_RL32(avctx->extradata + 4);
|
l->mode = AV_RL32(avctx->extradata + 4);
|
||||||
switch (l->mode) {
|
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;
|
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||||
break;
|
break;
|
||||||
case LOCO_CRGB: case LOCO_RGB:
|
case LOCO_CRGB:
|
||||||
|
case LOCO_RGB:
|
||||||
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
avctx->pix_fmt = AV_PIX_FMT_BGR24;
|
||||||
break;
|
break;
|
||||||
case LOCO_CYV12: case LOCO_YV12:
|
case LOCO_CYV12:
|
||||||
|
case LOCO_YV12:
|
||||||
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
|
||||||
break;
|
break;
|
||||||
case LOCO_CRGBA: case LOCO_RGBA:
|
case LOCO_CRGBA:
|
||||||
|
case LOCO_RGBA:
|
||||||
avctx->pix_fmt = AV_PIX_FMT_RGB32;
|
avctx->pix_fmt = AV_PIX_FMT_RGB32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -276,7 +291,8 @@ static av_cold int decode_init(AVCodecContext *avctx){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int decode_end(AVCodecContext *avctx){
|
static av_cold int decode_end(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
LOCOContext * const l = avctx->priv_data;
|
LOCOContext * const l = avctx->priv_data;
|
||||||
AVFrame *pic = &l->pic;
|
AVFrame *pic = &l->pic;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user