|
|
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:
14: // コントラスト (0-254) を適用。
15: // (ちなみに _gen は 1265 usec)
16: /*static*/ void
17: VideoCtlrDevice::RenderContrast_neon(BitmapRGBX& dst, const BitmapRGBX& src,
18: uint32 contrast)
19: {
20: // この変換は一次元配列とみなしても行える。
21: // また必ずテキスト画面全域なので端数の考慮は不要。
22: uint pxlen = src.GetWidth() * src.GetHeight();
23: const uint32 *s32 = (const uint32 *)src.GetRowPtr(0);
24: uint32 *d32 = (uint32 *)dst.GetRowPtr(0);
25: uint32 *d32end = d32 + pxlen;
26:
27: uint8x8_t vcont = vdup_n_u8(contrast);
28:
29: for (; d32 < d32end; ) {
30: // 2ピクセルずつ処理する
31: // 614 usec
32:
33: uint8x8_t vsrc = vld1_u8((const uint8 *)s32);
34: uint16x8_t vmul = vmull_u8(vsrc, vcont);
35: uint8x8_t vres = vrshrn_n_u16(vmul, 8);
36: vst1_u8((uint8 *)d32, vres);
37: s32 += 2;
38: d32 += 2;
39: }
40: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.