Hi,

On Wed, Nov 30, 2011 at 9:23 AM, Thad Ward <[email protected]> wrote:
> -        for (i = 0; i < 4; i++)
> +        for (i = 0; i < planes; i++)
>             srcs[i] = l->rgb_planes + i * l->rgb_stride * avctx->height;
>         for (j = 0; j < avctx->height; j++) {
>             for (i = 0; i < avctx->width; i++) {
> @@ -514,13 +522,19 @@ static int lag_decode_frame(AVCodecContext *avctx,
>                 r = srcs[0][i];
>                 g = srcs[1][i];
>                 b = srcs[2][i];
> -                a = srcs[3][i];
>                 r += g;
>                 b += g;
> -                AV_WN32(dst + i * 4, MKBETAG(a, r, g, b));
> +                if (FRAME_ARITH_RGBA == frametype) {
> +                    a = srcs[3][i];
> +                    AV_WN32(dst + i * 4, MKBETAG(a, r, g, b));
> +                } else {
> +                    dst[i * 3 + 0] = r;
> +                    dst[i * 3 + 1] = g;
> +                    dst[i * 3 + 2] = b;
> +                }
>             }
>             dst += p->linesize[0];
> -            for (i = 0; i < 4; i++)
> +            for (i = 0; i < planes; i++)
>                 srcs[i] += l->rgb_stride;
>         }
>         break;


It seems to me you're adding an if to a inner loop here. Can you
instead duplicate the loop, or make it into a separate
(av_always_inline) function with proper ifs that get inlined, so that
the if in the binary code is outside the loop?

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

Reply via email to