mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 22:02:27 +00:00
Work on magic numbers for aarch64
This commit is contained in:
parent
59766efd3e
commit
5a455eaa0b
2070 changed files with 4567 additions and 4200 deletions
|
@ -1,21 +1,25 @@
|
|||
#ifndef COSMOPOLITAN_TOOL_VIZ_LIB_CONVOLVE_H_
|
||||
#define COSMOPOLITAN_TOOL_VIZ_LIB_CONVOLVE_H_
|
||||
#include "dsp/tty/quant.h"
|
||||
#include "libc/str/str.h"
|
||||
#include "tool/viz/lib/graphic.h"
|
||||
#if !(__ASSEMBLER__ + __LINKER__ + 0)
|
||||
COSMOPOLITAN_C_START_
|
||||
|
||||
forceinline void convolve(unsigned yn, unsigned xn, __m128 img[yn][xn], int KW,
|
||||
const float kernel[KW][KW], float C1, float C2) {
|
||||
typedef float convolve_t __attribute__((__vector_size__(16)));
|
||||
|
||||
forceinline void convolve(unsigned yn, unsigned xn, ttyrgb_m128 img[yn][xn],
|
||||
int KW, const float kernel[KW][KW], float C1,
|
||||
float C2) {
|
||||
/* TODO(jart): nontemporal herringbone strategy */
|
||||
float f;
|
||||
struct Graphic g;
|
||||
unsigned y, x, i, j;
|
||||
__v4sf p, kflip[KW][KW], (*tmp)[yn][xn];
|
||||
convolve_t p, kflip[KW][KW], (*tmp)[yn][xn];
|
||||
for (i = 0; i < KW; ++i) {
|
||||
for (j = 0; j < KW; ++j) {
|
||||
f = kernel[i][j] / C1;
|
||||
kflip[KW - i - 1][KW - j - 1] = (__v4sf){f, f, f, f};
|
||||
kflip[KW - i - 1][KW - j - 1] = (convolve_t){f, f, f, f};
|
||||
}
|
||||
}
|
||||
bzero(&g, sizeof(g));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue