Annotation of nono/vm/accel_neon.cpp, revision 1.1.1.2

1.1       root        1: //
                      2: // nono
                      3: // Copyright (C) 2024 nono project
                      4: // Licensed under nono-license.txt
                      5: //
                      6: 
                      7: //
                      8: // NEON
                      9: //
                     10: 
                     11: #include "videoctlr.h"
                     12: #include <arm_neon.h>
                     13: 
1.1.1.2 ! root       14: // コントラスト (1-254) を適用。dst サイズでクリップする。
1.1       root       15: // (ちなみに _gen は 1265 usec)
                     16: /*static*/ void
                     17: VideoCtlrDevice::RenderContrast_neon(BitmapRGBX& dst, const BitmapRGBX& src,
                     18:        uint32 contrast)
                     19: {
                     20:        uint8x8_t vcont = vdup_n_u8(contrast);
                     21: 
1.1.1.2 ! root       22:        // 今のところ幅は 2ピクセルで割り切れる。
        !            23:        uint width = dst.GetWidth();
        !            24:        for (uint y = 0, yend = dst.GetHeight(); y < yend; y++) {
        !            25:                const uint32 *s32 = (const uint32 *)src.GetRowPtr(y);
        !            26:                uint32 *d32 = (uint32 *)dst.GetRowPtr(y);
        !            27:                uint32 *d32end = d32 + width;
        !            28:                for (; d32 < d32end; ) {
        !            29:                        // 2ピクセルずつ処理する。
        !            30:                        // 614 usec
1.1       root       31: 
1.1.1.2 ! root       32:                        uint8x8_t  vsrc = vld1_u8((const uint8 *)s32);
        !            33:                        uint16x8_t vmul = vmull_u8(vsrc, vcont);
        !            34:                        uint8x8_t  vres = vrshrn_n_u16(vmul, 8);
        !            35:                        vst1_u8((uint8 *)d32, vres);
        !            36:                        s32 += 2;
        !            37:                        d32 += 2;
        !            38:                }
1.1       root       39:        }
                     40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.