indeo2: cosmetics, reformat
This commit is contained in:
parent
7b1fbd4729
commit
c04c64c08e
@ -47,8 +47,8 @@ static inline int ir2_get_code(GetBitContext *gb)
|
|||||||
return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1) + 1;
|
return get_vlc2(gb, ir2_vlc.table, CODE_VLC_BITS, 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst, int stride,
|
static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst,
|
||||||
const uint8_t *table)
|
int stride, const uint8_t *table)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int j;
|
int j;
|
||||||
@ -56,15 +56,15 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
|||||||
int c;
|
int c;
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
if(width&1)
|
if (width & 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
/* first line contain absolute values, other lines contain deltas */
|
/* first line contain absolute values, other lines contain deltas */
|
||||||
while (out < width){
|
while (out < width) {
|
||||||
c = ir2_get_code(&ctx->gb);
|
c = ir2_get_code(&ctx->gb);
|
||||||
if(c >= 0x80) { /* we have a run */
|
if (c >= 0x80) { /* we have a run */
|
||||||
c -= 0x7F;
|
c -= 0x7F;
|
||||||
if(out + c*2 > width)
|
if (out + c*2 > width)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
for (i = 0; i < c * 2; i++)
|
for (i = 0; i < c * 2; i++)
|
||||||
dst[out++] = 0x80;
|
dst[out++] = 0x80;
|
||||||
@ -75,25 +75,25 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
|||||||
}
|
}
|
||||||
dst += stride;
|
dst += stride;
|
||||||
|
|
||||||
for (j = 1; j < height; j++){
|
for (j = 1; j < height; j++) {
|
||||||
out = 0;
|
out = 0;
|
||||||
while (out < width){
|
while (out < width) {
|
||||||
c = ir2_get_code(&ctx->gb);
|
c = ir2_get_code(&ctx->gb);
|
||||||
if(c >= 0x80) { /* we have a skip */
|
if (c >= 0x80) { /* we have a skip */
|
||||||
c -= 0x7F;
|
c -= 0x7F;
|
||||||
if(out + c*2 > width)
|
if (out + c*2 > width)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
for (i = 0; i < c * 2; i++) {
|
for (i = 0; i < c * 2; i++) {
|
||||||
dst[out] = dst[out - stride];
|
dst[out] = dst[out - stride];
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
} else { /* add two deltas from table */
|
} else { /* add two deltas from table */
|
||||||
t = dst[out - stride] + (table[c * 2] - 128);
|
t = dst[out - stride] + (table[c * 2] - 128);
|
||||||
t= av_clip_uint8(t);
|
t = av_clip_uint8(t);
|
||||||
dst[out] = t;
|
dst[out] = t;
|
||||||
out++;
|
out++;
|
||||||
t = dst[out - stride] + (table[(c * 2) + 1] - 128);
|
t = dst[out - stride] + (table[(c * 2) + 1] - 128);
|
||||||
t= av_clip_uint8(t);
|
t = av_clip_uint8(t);
|
||||||
dst[out] = t;
|
dst[out] = t;
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
@ -103,31 +103,31 @@ static int ir2_decode_plane(Ir2Context *ctx, int width, int height, uint8_t *dst
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_t *dst, int stride,
|
static int ir2_decode_plane_inter(Ir2Context *ctx, int width, int height, uint8_t *dst,
|
||||||
const uint8_t *table)
|
int stride, const uint8_t *table)
|
||||||
{
|
{
|
||||||
int j;
|
int j;
|
||||||
int out = 0;
|
int out = 0;
|
||||||
int c;
|
int c;
|
||||||
int t;
|
int t;
|
||||||
|
|
||||||
if(width&1)
|
if (width & 1)
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
for (j = 0; j < height; j++){
|
for (j = 0; j < height; j++) {
|
||||||
out = 0;
|
out = 0;
|
||||||
while (out < width){
|
while (out < width) {
|
||||||
c = ir2_get_code(&ctx->gb);
|
c = ir2_get_code(&ctx->gb);
|
||||||
if(c >= 0x80) { /* we have a skip */
|
if (c >= 0x80) { /* we have a skip */
|
||||||
c -= 0x7F;
|
c -= 0x7F;
|
||||||
out += c * 2;
|
out += c * 2;
|
||||||
} else { /* add two deltas from table */
|
} else { /* add two deltas from table */
|
||||||
t = dst[out] + (((table[c * 2] - 128)*3) >> 2);
|
t = dst[out] + (((table[c * 2] - 128)*3) >> 2);
|
||||||
t= av_clip_uint8(t);
|
t = av_clip_uint8(t);
|
||||||
dst[out] = t;
|
dst[out] = t;
|
||||||
out++;
|
out++;
|
||||||
t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2);
|
t = dst[out] + (((table[(c * 2) + 1] - 128)*3) >> 2);
|
||||||
t= av_clip_uint8(t);
|
t = av_clip_uint8(t);
|
||||||
dst[out] = t;
|
dst[out] = t;
|
||||||
out++;
|
out++;
|
||||||
}
|
}
|
||||||
@ -141,14 +141,14 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
|||||||
void *data, int *got_frame,
|
void *data, int *got_frame,
|
||||||
AVPacket *avpkt)
|
AVPacket *avpkt)
|
||||||
{
|
{
|
||||||
const uint8_t *buf = avpkt->data;
|
|
||||||
int buf_size = avpkt->size;
|
|
||||||
Ir2Context * const s = avctx->priv_data;
|
Ir2Context * const s = avctx->priv_data;
|
||||||
AVFrame *picture = data;
|
const uint8_t *buf = avpkt->data;
|
||||||
AVFrame * const p = &s->picture;
|
int buf_size = avpkt->size;
|
||||||
|
AVFrame *picture = data;
|
||||||
|
AVFrame * const p = &s->picture;
|
||||||
int start, ret;
|
int start, ret;
|
||||||
|
|
||||||
if(p->data[0])
|
if (p->data[0])
|
||||||
avctx->release_buffer(avctx, p);
|
avctx->release_buffer(avctx, p);
|
||||||
|
|
||||||
p->reference = 1;
|
p->reference = 1;
|
||||||
@ -212,7 +212,8 @@ static int ir2_decode_frame(AVCodecContext *avctx,
|
|||||||
return buf_size;
|
return buf_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int ir2_decode_init(AVCodecContext *avctx){
|
static av_cold int ir2_decode_init(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
Ir2Context * const ic = avctx->priv_data;
|
Ir2Context * const ic = avctx->priv_data;
|
||||||
static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
|
static VLC_TYPE vlc_tables[1 << CODE_VLC_BITS][2];
|
||||||
|
|
||||||
@ -235,7 +236,8 @@ static av_cold int ir2_decode_init(AVCodecContext *avctx){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static av_cold int ir2_decode_end(AVCodecContext *avctx){
|
static av_cold int ir2_decode_end(AVCodecContext *avctx)
|
||||||
|
{
|
||||||
Ir2Context * const ic = avctx->priv_data;
|
Ir2Context * const ic = avctx->priv_data;
|
||||||
AVFrame *pic = &ic->picture;
|
AVFrame *pic = &ic->picture;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user