diff options
author | Paul B Mahol <onemda@gmail.com> | 2020-07-29 10:01:35 +0200 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2020-08-02 09:31:54 +0200 |
commit | fabbb680d42aa81d1a7b3138b1f66d8ddd7ce81d (patch) | |
tree | e96db92b361f9c32c388acf600f9cad8a7d16d3b /libavcodec/cfhd.c | |
parent | 21e86a12e6ae3e977ba78edf23689be1c4219d71 (diff) | |
download | ffmpeg-fabbb680d42aa81d1a7b3138b1f66d8ddd7ce81d.tar.gz |
avcodec/cfhd: move if/else out of loop in inverse transform
Diffstat (limited to 'libavcodec/cfhd.c')
-rw-r--r-- | libavcodec/cfhd.c | 62 |
1 files changed, 30 insertions, 32 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c index 299d98780c..91f4cc7e46 100644 --- a/libavcodec/cfhd.c +++ b/libavcodec/cfhd.c @@ -211,39 +211,37 @@ static inline void filter(int16_t *output, ptrdiff_t out_stride, int16_t tmp; int i; - for (i = 0; i < len; i++) { - if (i == 0) { - tmp = (11*low[0*low_stride] - 4*low[1*low_stride] + low[2*low_stride] + 4) >> 3; - output[(2*i+0)*out_stride] = (tmp + high[0*high_stride]) >> 1; - if (clip) - output[(2*i+0)*out_stride] = av_clip_uintp2_c(output[(2*i+0)*out_stride], clip); - - tmp = ( 5*low[0*low_stride] + 4*low[1*low_stride] - low[2*low_stride] + 4) >> 3; - output[(2*i+1)*out_stride] = (tmp - high[0*high_stride]) >> 1; - if (clip) - output[(2*i+1)*out_stride] = av_clip_uintp2_c(output[(2*i+1)*out_stride], clip); - } else if (i == len-1) { - tmp = ( 5*low[i*low_stride] + 4*low[(i-1)*low_stride] - low[(i-2)*low_stride] + 4) >> 3; - output[(2*i+0)*out_stride] = (tmp + high[i*high_stride]) >> 1; - if (clip) - output[(2*i+0)*out_stride] = av_clip_uintp2_c(output[(2*i+0)*out_stride], clip); - - tmp = (11*low[i*low_stride] - 4*low[(i-1)*low_stride] + low[(i-2)*low_stride] + 4) >> 3; - output[(2*i+1)*out_stride] = (tmp - high[i*high_stride]) >> 1; - if (clip) - output[(2*i+1)*out_stride] = av_clip_uintp2_c(output[(2*i+1)*out_stride], clip); - } else { - tmp = (low[(i-1)*low_stride] - low[(i+1)*low_stride] + 4) >> 3; - output[(2*i+0)*out_stride] = (tmp + low[i*low_stride] + high[i*high_stride]) >> 1; - if (clip) - output[(2*i+0)*out_stride] = av_clip_uintp2_c(output[(2*i+0)*out_stride], clip); - - tmp = (low[(i+1)*low_stride] - low[(i-1)*low_stride] + 4) >> 3; - output[(2*i+1)*out_stride] = (tmp + low[i*low_stride] - high[i*high_stride]) >> 1; - if (clip) - output[(2*i+1)*out_stride] = av_clip_uintp2_c(output[(2*i+1)*out_stride], clip); - } + tmp = (11*low[0*low_stride] - 4*low[1*low_stride] + low[2*low_stride] + 4) >> 3; + output[(2*0+0)*out_stride] = (tmp + high[0*high_stride]) >> 1; + if (clip) + output[(2*0+0)*out_stride] = av_clip_uintp2_c(output[(2*0+0)*out_stride], clip); + + tmp = ( 5*low[0*low_stride] + 4*low[1*low_stride] - low[2*low_stride] + 4) >> 3; + output[(2*0+1)*out_stride] = (tmp - high[0*high_stride]) >> 1; + if (clip) + output[(2*0+1)*out_stride] = av_clip_uintp2_c(output[(2*0+1)*out_stride], clip); + + for (i = 1; i < len - 1; i++) { + tmp = (low[(i-1)*low_stride] - low[(i+1)*low_stride] + 4) >> 3; + output[(2*i+0)*out_stride] = (tmp + low[i*low_stride] + high[i*high_stride]) >> 1; + if (clip) + output[(2*i+0)*out_stride] = av_clip_uintp2_c(output[(2*i+0)*out_stride], clip); + + tmp = (low[(i+1)*low_stride] - low[(i-1)*low_stride] + 4) >> 3; + output[(2*i+1)*out_stride] = (tmp + low[i*low_stride] - high[i*high_stride]) >> 1; + if (clip) + output[(2*i+1)*out_stride] = av_clip_uintp2_c(output[(2*i+1)*out_stride], clip); } + + tmp = ( 5*low[i*low_stride] + 4*low[(i-1)*low_stride] - low[(i-2)*low_stride] + 4) >> 3; + output[(2*i+0)*out_stride] = (tmp + high[i*high_stride]) >> 1; + if (clip) + output[(2*i+0)*out_stride] = av_clip_uintp2_c(output[(2*i+0)*out_stride], clip); + + tmp = (11*low[i*low_stride] - 4*low[(i-1)*low_stride] + low[(i-2)*low_stride] + 4) >> 3; + output[(2*i+1)*out_stride] = (tmp - high[i*high_stride]) >> 1; + if (clip) + output[(2*i+1)*out_stride] = av_clip_uintp2_c(output[(2*i+1)*out_stride], clip); } static inline void interlaced_vertical_filter(int16_t *output, int16_t *low, int16_t *high, |