On Thu, Feb 23, 2017 at 6:18 AM, Diego Biurrun <di...@biurrun.de> wrote: > On Wed, Feb 22, 2017 at 12:53:35PM -0500, Vittorio Giovara wrote: >> --- /dev/null >> +++ b/libavcodec/pixlet.c >> @@ -0,0 +1,689 @@ >> +static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t >> *dst, >> + int size, int64_t c, int a, int64_t d, >> + int width, ptrdiff_t stride) >> +{ >> + PixletContext *ctx = avctx->priv_data; >> + BitstreamContext *bc = &ctx->bc; >> + unsigned cnt1, shbits, rlen, nbits, length, i = 0, j = 0, k; >> + int ret, escape, pfx, value, yflag, xflag, flag = 0; >> + int64_t state = 3, tmp; >> + >> + while (i < size) { >> + if (state >> 8 != -3) { >> + value = ff_clz((state >> 8) + 3) ^ 0x1F; >> + } else { >> + value = -1; >> + } > > nit: pointless () > >> + cnt1 = get_unary(bc, 0, length); >> + if (cnt1 >= length) { >> + cnt1 = bitstream_read(bc, nbits); >> + } else { >> + pfx = 14 + ((((uint64_t) (value - 14)) >> 32) & (value - >> 14)); > > Maybe just make value uint64_t instead of casting? > >> +static int read_highpass(AVCodecContext *avctx, uint8_t *ptr, >> + int plane, AVFrame *frame) >> +{ >> + for (i = 0; i < ctx->levels * 3; i++) { >> + uint32_t magic = bytestream2_get_be32(&ctx->gb); >> + >> + if (magic != PIXLET_MAGIC) { >> + av_log(avctx, AV_LOG_ERROR, >> + "wrong magic number: 0x%08X for plane %d, band %d\n", >> + magic, plane, i); > > magic is uint32_t, use the correct C99 printf conversion specifier. > >> +static int pixlet_decode_frame(AVCodecContext *avctx, void *data, >> + int *got_frame, AVPacket *avpkt) >> +{ >> + uint32_t pktsize; >> + >> + pktsize = bytestream2_get_be32(&ctx->gb); >> + if (pktsize <= 44 || pktsize - 4 > >> bytestream2_get_bytes_left(&ctx->gb)) { >> + av_log(avctx, AV_LOG_ERROR, "Invalid packet size %u.\n", pktsize); > > same
all comments applied, thanks -- Vittorio _______________________________________________ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel