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: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-12-23 15:03:15 +01:00
commit 8e09e183fc
4 changed files with 143 additions and 143 deletions

View File

@ -44,9 +44,6 @@
static const enum AVPixelFormat pixfmt_rgb24[] = {
AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
/*
* Decoder context
*/
typedef struct EightBpsContext {
AVCodecContext *avctx;
AVFrame pic;
@ -57,12 +54,6 @@ typedef struct EightBpsContext {
uint32_t pal[256];
} EightBpsContext;
/*
*
* Decode a frame
*
*/
static int decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
@ -151,12 +142,6 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return buf_size;
}
/*
*
* Init 8BPS decoder
*
*/
static av_cold int decode_init(AVCodecContext *avctx)
{
EightBpsContext * const c = avctx->priv_data;
@ -202,14 +187,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
/*
*
* Uninit 8BPS decoder
*
*/
static av_cold int decode_end(AVCodecContext *avctx)
{
EightBpsContext * const c = avctx->priv_data;
@ -220,8 +197,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
return 0;
}
AVCodec ff_eightbps_decoder = {
.name = "8bps",
.type = AVMEDIA_TYPE_VIDEO,

View File

@ -43,7 +43,8 @@ static VLC dc_ccp_vlc;
static VLC ac_ccp_vlc;
static VLC asv2_level_vlc;
static av_cold void init_vlcs(ASV1Context *a){
static av_cold void init_vlcs(ASV1Context *a)
{
static int done = 0;
if (!done) {
@ -68,25 +69,33 @@ static av_cold void init_vlcs(ASV1Context *a){
}
//FIXME write a reversed bitstream reader to avoid the double reverse
static inline int asv2_get_bits(GetBitContext *gb, int n){
static inline int asv2_get_bits(GetBitContext *gb, int n)
{
return ff_reverse[get_bits(gb, n) << (8-n)];
}
static inline int asv1_get_level(GetBitContext *gb){
static inline int asv1_get_level(GetBitContext *gb)
{
int code = get_vlc2(gb, level_vlc.table, VLC_BITS, 1);
if(code==3) return get_sbits(gb, 8);
else return code - 3;
if (code == 3)
return get_sbits(gb, 8);
else
return code - 3;
}
static inline int asv2_get_level(GetBitContext *gb){
static inline int asv2_get_level(GetBitContext *gb)
{
int code = get_vlc2(gb, asv2_level_vlc.table, ASV2_LEVEL_VLC_BITS, 1);
if(code==31) return (int8_t)asv2_get_bits(gb, 8);
else return code - 31;
if (code == 31)
return (int8_t)asv2_get_bits(gb, 8);
else
return code - 31;
}
static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64])
{
int i;
block[0] = 8 * get_bits(&a->gb, 8);
@ -95,23 +104,29 @@ static inline int asv1_decode_block(ASV1Context *a, DCTELEM block[64]){
const int ccp = get_vlc2(&a->gb, ccp_vlc.table, VLC_BITS, 1);
if (ccp) {
if(ccp == 16) break;
if (ccp == 16)
break;
if (ccp < 0 || i >= 10) {
av_log(a->avctx, AV_LOG_ERROR, "coded coeff pattern damaged\n");
return -1;
}
if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv1_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
if (ccp & 8)
block[a->scantable.permutated[4 * i + 0]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 0]) >> 4;
if (ccp & 4)
block[a->scantable.permutated[4 * i + 1]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 1]) >> 4;
if (ccp & 2)
block[a->scantable.permutated[4 * i + 2]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 2]) >> 4;
if (ccp & 1)
block[a->scantable.permutated[4 * i + 3]] = (asv1_get_level(&a->gb) * a->intra_matrix[4 * i + 3]) >> 4;
}
}
return 0;
}
static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){
static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64])
{
int i, count, ccp;
count = asv2_get_bits(&a->gb, 4);
@ -120,26 +135,34 @@ static inline int asv2_decode_block(ASV1Context *a, DCTELEM block[64]){
ccp = get_vlc2(&a->gb, dc_ccp_vlc.table, VLC_BITS, 1);
if (ccp) {
if(ccp&4) block[a->scantable.permutated[1]]= (asv2_get_level(&a->gb) * a->intra_matrix[1])>>4;
if(ccp&2) block[a->scantable.permutated[2]]= (asv2_get_level(&a->gb) * a->intra_matrix[2])>>4;
if(ccp&1) block[a->scantable.permutated[3]]= (asv2_get_level(&a->gb) * a->intra_matrix[3])>>4;
if (ccp & 4)
block[a->scantable.permutated[1]] = (asv2_get_level(&a->gb) * a->intra_matrix[1]) >> 4;
if (ccp & 2)
block[a->scantable.permutated[2]] = (asv2_get_level(&a->gb) * a->intra_matrix[2]) >> 4;
if (ccp & 1)
block[a->scantable.permutated[3]] = (asv2_get_level(&a->gb) * a->intra_matrix[3]) >> 4;
}
for (i = 1; i < count + 1; i++) {
const int ccp = get_vlc2(&a->gb, ac_ccp_vlc.table, VLC_BITS, 1);
if (ccp) {
if(ccp&8) block[a->scantable.permutated[4*i+0]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+0])>>4;
if(ccp&4) block[a->scantable.permutated[4*i+1]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+1])>>4;
if(ccp&2) block[a->scantable.permutated[4*i+2]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+2])>>4;
if(ccp&1) block[a->scantable.permutated[4*i+3]]= (asv2_get_level(&a->gb) * a->intra_matrix[4*i+3])>>4;
if (ccp & 8)
block[a->scantable.permutated[4*i + 0]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 0]) >> 4;
if (ccp & 4)
block[a->scantable.permutated[4*i + 1]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 1]) >> 4;
if (ccp & 2)
block[a->scantable.permutated[4*i + 2]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 2]) >> 4;
if (ccp & 1)
block[a->scantable.permutated[4*i + 3]] = (asv2_get_level(&a->gb) * a->intra_matrix[4*i + 3]) >> 4;
}
}
return 0;
}
static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64])
{
int i;
a->dsp.clear_blocks(block[0]);
@ -158,7 +181,8 @@ static inline int decode_mb(ASV1Context *a, DCTELEM block[6][64]){
return 0;
}
static inline void idct_put(ASV1Context *a, int mb_x, int mb_y){
static inline void idct_put(ASV1Context *a, int mb_x, int mb_y)
{
DCTELEM (*block)[64] = a->block;
int linesize = a->picture.linesize[0];
@ -181,9 +205,9 @@ static int decode_frame(AVCodecContext *avctx,
void *data, int *got_frame,
AVPacket *avpkt)
{
ASV1Context * const a = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
ASV1Context * const a = avctx->priv_data;
AVFrame *picture = data;
AVFrame * const p = &a->picture;
int mb_x, mb_y;
@ -251,11 +275,12 @@ static int decode_frame(AVCodecContext *avctx,
return (get_bits_count(&a->gb) + 31) / 32 * 4;
}
static av_cold int decode_init(AVCodecContext *avctx){
static av_cold int decode_init(AVCodecContext *avctx)
{
ASV1Context * const a = avctx->priv_data;
AVFrame *p = &a->picture;
int i;
const int scale = avctx->codec_id == AV_CODEC_ID_ASV1 ? 1 : 2;
int i;
ff_asv_common_init(avctx);
init_vlcs(a);
@ -284,7 +309,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)
{
ASV1Context * const a = avctx->priv_data;
av_freep(&a->bitstream_buffer);

View File

@ -51,7 +51,6 @@ static int aura_decode_frame(AVCodecContext *avctx,
AVPacket *pkt)
{
AuraDecodeContext *s = avctx->priv_data;
uint8_t *Y, *U, *V;
uint8_t val;
int x, y;