[FFmpeg-devel] [PATCH] avcodec/scpr: optimize shift loop.

Michael Niedermayer michael at niedermayer.cc
Sun Sep 10 01:47:57 EEST 2017


On Sat, Sep 09, 2017 at 04:37:52PM -0500, Brian Matherly wrote:
> 
> On 9/9/2017 1:27 PM, Michael Niedermayer wrote:
> >+            // If the image is sufficiently aligned, compute 8 samples at once
> >+            if (!(((uintptr_t)dst) & 7)) {
> >+                uint64_t *dst64 = (uint64_t *)dst;
> >+                int w = avctx->width>>1;
> >+                for (x = 0; x < w; x++) {
> >+                    dst64[x] = (dst64[x] << 3) & 0xFCFCFCFCFCFCFCFCULL;
> >+                }
> >+                x *= 8;
> >+            } else
> >+                x = 0;
> >+            for (; x < avctx->width * 4; x++) {
> >                  dst[x] = dst[x] << 3;
> >              }
> 
> Forgive me if I'm not understanding the code correctly, but couldn't
> you always apply the optimization if you align the first (up to) 7
> samples?

yes, thats possible, it would be optimizing a case that probably
never occurs in practice though.

If people want, i can add code to handle misaligned cases ?

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170910/8a42b900/attachment.sig>


More information about the ffmpeg-devel mailing list