On Sun, Jun 23, 2013 at 08:50:07AM +0200, Luca Barbato wrote:
> --- a/libavcodec/jpeg2000.h
> +++ b/libavcodec/jpeg2000.h
> @@ -146,6 +146,8 @@ typedef struct Jpeg2000CodingStyle {
>  
> +#define MAX_LEVELS 32 * 3
> +
>  typedef struct Jpeg2000QuantStyle {
>      uint8_t expn[JPEG2000_MAX_DECLEVELS * 3];  // quantization exponent
>      uint32_t mant[JPEG2000_MAX_DECLEVELS * 3]; // quantization mantissa

This is only used in the .c file, move it there.  Also, I would guess
we have a #define for the magic number already.

> --- a/libavcodec/jpeg2000dec.c
> +++ b/libavcodec/jpeg2000dec.c
> @@ -98,26 +95,22 @@ typedef struct Jpeg2000DecoderContext {
>          s->bit_index--;
> -        res |= (*s->buf >> s->bit_index) & 1;
> +        res |= (bytestream2_peek_byte(&s->g) >> s->bit_index) & 1;

pointless ()

> @@ -1251,19 +1244,18 @@ static int 
> jpeg2000_read_bitstream_packets(Jpeg2000DecoderContext *s)
>  
> -    // Skip JPEG 2000 signature atom.
> -    s->buf += 12;
> -
> -    while (!found_codestream && search_range) {
> -        atom_size = AV_RB32(s->buf);
> -        if (AV_RB32(s->buf + 4) == JP2_CODESTREAM) {
> +    while(!found_codestream && search_range && 
> bytestream2_get_bytes_left(&s->g) >= 8) {

nit: long line

> @@ -1326,9 +1322,10 @@ static int jpeg2000_decode_frame(AVCodecContext 
> *avctx, void *data,
>  
>      *got_frame = 1;
>  
> +    return bytestream2_tell(&s->g);
>  end:
>      jpeg2000_dec_cleanup(s);
> -    return ret ? ret : s->buf - s->buf_start;
> +    return ret;
>  }

Leave the empty line before the goto label.

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

Reply via email to