Am 27.06.2017 um 21:47 schrieb Michael Niedermayer:
> 0.5% faster loop
> 
> Signed-off-by: Michael Niedermayer <mich...@niedermayer.cc>
> ---
>  libavcodec/utvideodec.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c
> index 788f4475b9..a20e28320c 100644
> --- a/libavcodec/utvideodec.c
> +++ b/libavcodec/utvideodec.c
> @@ -196,7 +196,8 @@ static int decode_plane10(UtvideoContext *c, int plane_no,
>  
>          prev = 0x200;
>          for (j = sstart; j < send; j++) {
> -            for (i = 0; i < width * step; i += step) {
> +            int ws = width * step;
> +            for (i = 0; i < ws; i += step) {
>                  pix = get_vlc2(&gb, vlc.table, VLC_BITS, 3);

This seems like a pretty obvious optimization, why doesn't gcc or any
other compiler see that it can pre-compute that before the loop, as
nothing in the loop changes both variables?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to