[FFmpeg-devel] [PATCH] Electronic Arts MAD Decoder

Diego Biurrun diego
Sun Jun 7 10:23:41 CEST 2009


On Sun, Jun 07, 2009 at 04:24:59PM +1000, Peter Ross wrote:
> Demuxer and decoder patches enclosed.

Can we please have consistent K&R style for new files?  You currently
use a wild inconsistent mix..

This means spaces after if/for/while/switch, with space before { on the
same line, { on the next line after function declarations, no space
between function name and (, space after comma in parameter lists and
variable lists, generous use of spaces around operators.

> --- libavcodec/eamad.c	(revision 0)
> +++ libavcodec/eamad.c	(revision 0)
> @@ -0,0 +1,320 @@
> +
> +/**
> + * @file eamad.c

directory prefix

> +static void bswap16_buf(uint16_t *dst, const uint16_t *src, int count)
> +{
> +    int i;
> +    for(i=0; i<count; i++)

for (

> +static av_cold int mad_decode_init(AVCodecContext *avctx){

{ on the next line

> +static inline void mad_comp(unsigned char *dst, int dst_stride,
> +                            unsigned char *src, int src_stride,
> +                            int add){
> +    int j,i;
> +    for(j=0;j<8;j++)
> +    for(i=0;i<8;i++)
> +        dst[j*dst_stride + i] = av_clip_uint8(src[j*src_stride + i] + add);

wrong indentation

> +static inline void mad_idct_put(MadContext *t, DCTELEM *block, int mb_x, int mb_y, int i){

nit: long line

> +static int mad_decode_frame(AVCodecContext *avctx,
> +                            void *data, int *data_size,
> +                            AVPacket *avpkt) {
> +    const uint8_t *buf = avpkt->data;
> +    int buf_size = avpkt->size;

Stuff like this could be aligned.

> +    inter = chunk_type==MADm_TAG||chunk_type==MADe_TAG;

I think spaces would greatly aid readability here.

> +    t->frame.reference = 1;
> +    t->frame.buffer_hints = FF_BUFFER_HINTS_VALID;

align

> +    for (s->mb_y=0; s->mb_y<(avctx->height+15)/16; s->mb_y++)
> +    for (s->mb_x=0; s->mb_x<(avctx->width+15)/16; s->mb_x++)
> +        mad_decode_mb(t, inter);

indent

Diego



More information about the ffmpeg-devel mailing list