[FFmpeg-devel] [PATCH] libopenjpeg wrapper for jpeg2k decoding

Diego Biurrun diego
Wed Jan 28 09:26:56 CET 2009


On Wed, Jan 28, 2009 at 11:24:47AM +0530, Jai Menon wrote:
> 
> --- configure	(revision 16716)
> +++ configure	(working copy)
> @@ -1904,6 +1907,7 @@
>  enabled libmp3lame && require  libmp3lame lame/lame.h lame_init -lmp3lame -lm
>  enabled libnut     && require  libnut libnut.h nut_demuxer_init -lnut
> +enabled libopenjpeg && require2 libopenjpeg libopenjpeg/openjpeg.h opj_version -lopenjpeg

I think 'require' should work here.

> --- libavcodec/libopenjpeg.c	(revision 0)
> +++ libavcodec/libopenjpeg.c	(revision 0)
> @@ -0,0 +1,183 @@
> +static int check_image_attributes(opj_image_t *image)
> +{
> +    return(image->comps[0].dx == image->comps[1].dx
> +           && image->comps[1].dx == image->comps[2].dx
> +           && image->comps[0].dy == image->comps[1].dy
> +           && image->comps[1].dy == image->comps[2].dy
> +           && image->comps[0].prec == image->comps[1].prec
> +           && image->comps[1].prec == image->comps[2].prec);

This could be aligned in a nicer way if you put the && at the end of the line.

> +static int libopenjpeg_decode_frame(AVCodecContext *avctx,
> +                                 void *data, int *data_size,
> +                                 const uint8_t *buf, int buf_size)

indentation

> +    if(!image) {
> +    }
> +    if (avcodec_check_dimensions(avctx, width, height) < 0) {
> +    }

Inconsistent formatting; I would suggest K&R style with spaces.

> +                     av_log(avctx, AV_LOG_ERROR, "Only first component will be used\n");

.

> +        default: av_log(avctx, AV_LOG_ERROR, "%d components unsupported \n", image->numcomps);

.

> +            av_log(avctx, AV_LOG_ERROR, "Couldn't allocate image buffer\n");

Here also: End sentences in a period.

Diego




More information about the ffmpeg-devel mailing list