On Thu, Apr 18, 2013 at 06:44:51PM +0200, Nicolas Bertrand wrote:
> --- a/libavcodec/jpeg2000.c
> +++ b/libavcodec/jpeg2000.c
> @@ -308,9 +308,12 @@ int ff_jpeg2000_init_component(Jpeg2000Component *comp,
> +            /* BITEXACT computing case --> convert to int */
> +            if (avctx->flags & CODEC_FLAG_BITEXACT)
> +                band->stepsize = (int32_t)(band->stepsize * (1<<16));

spaces around <<

> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -266,7 +266,11 @@ static int get_cox(Jpeg2000DecoderContext *s, 
> Jpeg2000CodingStyle *c)
>      }
> -    c->transform = bytestream_get_byte(&s->buf); // transformation
> +    c->transform = bytestream_get_byte(&s->buf); // DWT transformation type
> +    /* set integer 9/7 DWT in case of BITEXACT flag*/

space before */

> @@ -881,31 +885,96 @@ static int decode_cblk(Jpeg2000DecoderContext *s, 
> Jpeg2000CodingStyle *codsty,
>  
> +/* TODO: Verify dequantization in case of lossless case

The comment sounds kind of scary :)

> +static void dequantization_float(int x, int y, Jpeg2000Cblk *cblk,
> +                                 Jpeg2000Component *comp,
> +                                 Jpeg2000T1Context *t1, Jpeg2000Band *band) {

{ on the next line

> +static void dequantization_int(int x, int y, Jpeg2000Cblk *cblk,
> +                               Jpeg2000Component *comp,
> +                               Jpeg2000T1Context *t1, Jpeg2000Band *band) {

same

> @@ -1034,16 +1095,17 @@ static int 
> jpeg2000_decode_tile(Jpeg2000DecoderContext *s, Jpeg2000Tile *tile,
>                      val = av_clip(val, 0, (1 << s->cbps[compno]) - 1);
>                      /* align 12 bit values in little-endian mode */
> -                    val  = val << 4;
> -                    *dst = val;
> -                    //*datap = (float)val;
> +                    *dst = (val << 4);

pointless ()

> @@ -1231,7 +1293,6 @@ static int jpeg2000_decode_frame(AVCodecContext *avctx, 
> void *data,
>  
>      return s->buf - s->buf_start;
>  }
> -
>  #define OFFSET(x) offsetof(Jpeg2000DecoderContext, x)
>  #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM

Is that on purpose?  I think it was better before.

> --- a/libavcodec/jpeg2000dwt.c
> +++ b/libavcodec/jpeg2000dwt.c
> @@ -30,17 +30,26 @@
>  
> +/* Defines for 9/7 DWT lifting parameters.
> + * Parameters are in float. */
> +#define F_LFTG_ALPHA  (1.586134342059924f)
> +#define F_LFTG_BETA   (0.052980118572961f)
> +#define F_LFTG_GAMMA  (0.882911075530934f)
> +#define F_LFTG_DELTA  (0.443506852043971f)
> +#define F_LFTG_K      (1.230174104914001f)
> +#define F_LFTG_X      (1.625732422f      )
> +
> +/* Lifting parameters in integer format.
> + * Computed as param = (float param) * (1 << 16) */
> +#define I_LFTG_ALPHA  (103949)
> +#define I_LFTG_BETA   (  3472)
> +#define I_LFTG_GAMMA  ( 57862)
> +#define I_LFTG_DELTA  ( 29066)
> +#define I_LFTG_K      ( 80621)
> +#define I_LFTG_X      (106544)

The parentheses are pointless; the defines are values, not expressions.

> +/* FIXME: Why use 1.625732422 instead of 1/F_LFTG_K?
> + * see (ISO/IEC 15444:1 (version 2002) F.3.8.2 */

Hmmmm...

> @@ -231,8 +327,11 @@ int ff_jpeg2000_dwt_init(DWTContext *s, uint16_t 
> border[2][2],
>      case FF_DWT97:
>          s->linebuf = av_malloc((maxlen + 12) * sizeof(float));
>          break;
> +     case FF_DWT97_INT:
> +        s->linebuf = av_malloc((maxlen + 12) * sizeof(int32_t));
> +        break;
>      case FF_DWT53:
> -        s->linebuf = av_malloc((maxlen + 6) * sizeof(int));
> +        s->linebuf = av_malloc((maxlen +  6) * sizeof(int32_t));

These sizeofs should better be sizeof(*var) than sizeof(type).

Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to