Commit 8e09e183 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  8bps: cosmetics
  aasc: cosmetics, reformat
  ansi: remove an extra return
  asvdec: cosmetics, reformat
  aura: cosmetics, reformat

Conflicts:
	libavcodec/aasc.c
	libavcodec/asvdec.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents def18e54 b6d7d4ef
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
static const enum AVPixelFormat pixfmt_rgb24[] = { static const enum AVPixelFormat pixfmt_rgb24[] = {
AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE }; AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
/*
* Decoder context
*/
typedef struct EightBpsContext { typedef struct EightBpsContext {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame pic; AVFrame pic;
...@@ -57,12 +54,6 @@ typedef struct EightBpsContext { ...@@ -57,12 +54,6 @@ typedef struct EightBpsContext {
uint32_t pal[256]; uint32_t pal[256];
} EightBpsContext; } EightBpsContext;
/*
*
* Decode a frame
*
*/
static int decode_frame(AVCodecContext *avctx, void *data, static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt) int *got_frame, AVPacket *avpkt)
{ {
...@@ -151,12 +142,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, ...@@ -151,12 +142,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return buf_size; return buf_size;
} }
/*
*
* Init 8BPS decoder
*
*/
static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_init(AVCodecContext *avctx)
{ {
EightBpsContext * const c = avctx->priv_data; EightBpsContext * const c = avctx->priv_data;
...@@ -202,14 +187,6 @@ static av_cold int decode_init(AVCodecContext *avctx) ...@@ -202,14 +187,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0; return 0;
} }
/*
*
* Uninit 8BPS decoder
*
*/
static av_cold int decode_end(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx)
{ {
EightBpsContext * const c = avctx->priv_data; EightBpsContext * const c = avctx->priv_data;
...@@ -220,8 +197,6 @@ static av_cold int decode_end(AVCodecContext *avctx) ...@@ -220,8 +197,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
return 0; return 0;
} }
AVCodec ff_eightbps_decoder = { AVCodec ff_eightbps_decoder = {
.name = "8bps", .name = "8bps",
.type = AVMEDIA_TYPE_VIDEO, .type = AVMEDIA_TYPE_VIDEO,
......
...@@ -79,8 +79,8 @@ static int aasc_decode_frame(AVCodecContext *avctx, ...@@ -79,8 +79,8 @@ static int aasc_decode_frame(AVCodecContext *avctx,
AVPacket *avpkt) AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
AascContext *s = avctx->priv_data; AascContext *s = avctx->priv_data;
int compr, i, stride, psize; int compr, i, stride, psize;
if (buf_size < 4) { if (buf_size < 4) {
...@@ -95,8 +95,8 @@ static int aasc_decode_frame(AVCodecContext *avctx, ...@@ -95,8 +95,8 @@ static int aasc_decode_frame(AVCodecContext *avctx,
return -1; return -1;
} }
compr = AV_RL32(buf); compr = AV_RL32(buf);
buf += 4; buf += 4;
buf_size -= 4; buf_size -= 4;
psize = avctx->bits_per_coded_sample / 8; psize = avctx->bits_per_coded_sample / 8;
switch (avctx->codec_tag) { switch (avctx->codec_tag) {
...@@ -105,11 +105,11 @@ static int aasc_decode_frame(AVCodecContext *avctx, ...@@ -105,11 +105,11 @@ static int aasc_decode_frame(AVCodecContext *avctx,
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb); ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break; break;
case MKTAG('A', 'A', 'S', 'C'): case MKTAG('A', 'A', 'S', 'C'):
switch(compr){ switch (compr) {
case 0: case 0:
stride = (avctx->width * psize + psize) & ~psize; stride = (avctx->width * psize + psize) & ~psize;
for(i = avctx->height - 1; i >= 0; i--){ for (i = avctx->height - 1; i >= 0; i--) {
if(avctx->width * psize > buf_size){ if (avctx->width * psize > buf_size) {
av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n"); av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");
break; break;
} }
......
This diff is collapsed.
...@@ -50,8 +50,7 @@ static int aura_decode_frame(AVCodecContext *avctx, ...@@ -50,8 +50,7 @@ static int aura_decode_frame(AVCodecContext *avctx,
void *data, int *got_frame, void *data, int *got_frame,
AVPacket *pkt) AVPacket *pkt)
{ {
AuraDecodeContext *s=avctx->priv_data; AuraDecodeContext *s = avctx->priv_data;
uint8_t *Y, *U, *V; uint8_t *Y, *U, *V;
uint8_t val; uint8_t val;
int x, y; int x, y;
...@@ -69,12 +68,12 @@ static int aura_decode_frame(AVCodecContext *avctx, ...@@ -69,12 +68,12 @@ static int aura_decode_frame(AVCodecContext *avctx,
/* pixel data starts 48 bytes in, after 3x16-byte tables */ /* pixel data starts 48 bytes in, after 3x16-byte tables */
buf += 48; buf += 48;
if(s->frame.data[0]) if (s->frame.data[0])
avctx->release_buffer(avctx, &s->frame); avctx->release_buffer(avctx, &s->frame);
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID;
s->frame.reference = 0; s->frame.reference = 0;
if(ff_get_buffer(avctx, &s->frame) < 0) { if (ff_get_buffer(avctx, &s->frame) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
...@@ -86,23 +85,23 @@ static int aura_decode_frame(AVCodecContext *avctx, ...@@ -86,23 +85,23 @@ static int aura_decode_frame(AVCodecContext *avctx,
/* iterate through each line in the height */ /* iterate through each line in the height */
for (y = 0; y < avctx->height; y++) { for (y = 0; y < avctx->height; y++) {
/* reset predictors */ /* reset predictors */
val = *buf++; val = *buf++;
U[0] = val & 0xF0; U[0] = val & 0xF0;
Y[0] = val << 4; Y[0] = val << 4;
val = *buf++; val = *buf++;
V[0] = val & 0xF0; V[0] = val & 0xF0;
Y[1] = Y[0] + delta_table[val & 0xF]; Y[1] = Y[0] + delta_table[val & 0xF];
Y += 2; U++; V++; Y += 2; U++; V++;
/* iterate through the remaining pixel groups (4 pixels/group) */ /* iterate through the remaining pixel groups (4 pixels/group) */
for (x = 1; x < (avctx->width >> 1); x++) { for (x = 1; x < (avctx->width >> 1); x++) {
val = *buf++; val = *buf++;
U[0] = U[-1] + delta_table[val >> 4]; U[0] = U[-1] + delta_table[val >> 4];
Y[0] = Y[-1] + delta_table[val & 0xF]; Y[0] = Y[-1] + delta_table[val & 0xF];
val = *buf++; val = *buf++;
V[0] = V[-1] + delta_table[val >> 4]; V[0] = V[-1] + delta_table[val >> 4];
Y[1] = Y[ 0] + delta_table[val & 0xF]; Y[1] = Y[ 0] + delta_table[val & 0xF];
Y += 2; U++; V++; Y += 2; U++; V++;
} }
Y += s->frame.linesize[0] - avctx->width; Y += s->frame.linesize[0] - avctx->width;
U += s->frame.linesize[1] - (avctx->width >> 1); U += s->frame.linesize[1] - (avctx->width >> 1);
...@@ -110,7 +109,7 @@ static int aura_decode_frame(AVCodecContext *avctx, ...@@ -110,7 +109,7 @@ static int aura_decode_frame(AVCodecContext *avctx,
} }
*got_frame = 1; *got_frame = 1;
*(AVFrame*)data= s->frame; *(AVFrame*)data = s->frame;
return pkt->size; return pkt->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