On Fri, Feb 03, 2017 at 05:57:33PM +0100, Vittorio Giovara wrote:
> --- /dev/null
> +++ b/libavcodec/pixlet.c
> @@ -0,0 +1,692 @@
> +static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t
> *dst,
> + int size, int c, int a, int 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;
> +
> + cnt1 = get_unary(bc, 0, length);
> + if (cnt1 >= length) {
> + cnt1 = bitstream_read(bc, nbits);
> + } else {
> + pfx = 14 + ((((uint64_t) (value - 14)) >> 32) & (value - 14));
> + }
> +
> + } else {
> + xflag &= 1u;
> + tmp = (int64_t) c * ((yflag + 1) >> 1) + (c >> 1);
> + value = xflag + (tmp ^ -xflag);
> + }
> + state += (int64_t) d * yflag - (d * state >> 8);
Maybe change the types of the variables instead of casting?
> +static int read_highpass(AVCodecContext *avctx, uint8_t *ptr,
> + int plane, AVFrame *frame)
> +{
> + PixletContext *ctx = avctx->priv_data;
> + ptrdiff_t stride = frame->linesize[plane] / 2;
> + int i, ret;
> +
> + for (i = 0; i < ctx->levels * 3; i++) {
> + int32_t a = bytestream2_get_be32(&ctx->gb);
> + int32_t b = bytestream2_get_be32(&ctx->gb);
> + int32_t c = bytestream2_get_be32(&ctx->gb);
> + int32_t d = bytestream2_get_be32(&ctx->gb);
> + int16_t *dest = (int16_t *)frame->data[plane] +
> + ctx->band[plane][i + 1].x +
> + ctx->band[plane][i + 1].y * stride;
> + unsigned size = ctx->band[plane][i + 1].size;
> + uint32_t magic;
> +
> + magic = bytestream2_get_be32(&ctx->gb);
nit: You could merge declaration and assignment here.
> +static void postprocess_luma(AVFrame *frame, int w, int h, int depth)
> +{
> + uint16_t *dsty = (uint16_t *)frame->data[0];
> + int16_t *srcy = (int16_t *)frame->data[0];
pointless casts?
> +static void postprocess_chroma(AVFrame *frame, int w, int h, int depth)
> +{
> + uint16_t *dstu = (uint16_t *)frame->data[1];
> + uint16_t *dstv = (uint16_t *)frame->data[2];
> + int16_t *srcu = (int16_t *)frame->data[1];
> + int16_t *srcv = (int16_t *)frame->data[2];
same?
> +static int decode_plane(AVCodecContext *avctx, int plane,
> + AVPacket *avpkt, AVFrame *frame)
> + dst = (int16_t *) frame->data[plane];
> + dst[0] = sign_extend(bytestream2_get_be16(&ctx->gb), 16);
same?
Diego
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel