39#define AVUTIL_AVASSERT_H
41#define AVUTIL_MACROS_H
43#define AV_STRINGIFY(s) AV_TOSTRING(s)
44#define AV_TOSTRING(s) #s
45#define av_assert0(cond) do { \
47 fprintf(stderr, "Assertion %s failed at %s:%d\n", \
48 AV_STRINGIFY(cond), __FILE__, __LINE__); \
52#define av_malloc(s) malloc(s)
53#define av_mallocz(s) calloc(1, s)
54#define av_realloc(p, s) realloc(p, s)
55#define av_strdup(s) strdup(s)
56#define av_free(p) free(p)
57#define FFMAX(a,b) ((a) > (b) ? (a) : (b))
58#define FFMIN(a,b) ((a) > (b) ? (b) : (a))
59#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0]))
60#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24))
64 void **pptr = (
void **) ptr;
87 const uint8_t *elem_data)
89 uint8_t *tab_elem_data =
NULL;
92 tab_elem_data = (uint8_t *)*tab_ptr + (*nb_ptr) * elem_size;
94 memcpy(tab_elem_data, elem_data, elem_size);
122#define ENTRY(fname, ...) { .name = #fname, .params = __VA_ARGS__ },
131#define IMPL_PRIV(s) a64op_off(s->impl, offsetof_impl_priv)
161 if (p->block_size == 16) {
162 i_movi(
r, bitmask_vec.
b16,
IMM(1));
CMT(
"v128 bitmask_vec = {1 <repeats 16 times>};");
164 i_movi(
r, bitmask_vec.
b8,
IMM(1));
CMT(
"v128 bitmask_vec = {1 <repeats 8 times>, 0 <repeats 8 times>};");
174 rasm_annotate_next(
r,
"v128 nibble_mask = {0xf <repeats 8 times>, 0x0 <repeats 8 times>};");
195 uint32_t mask_val[4] = { 0 };
200 uint32_t
val = (1u << p->par.pack.pattern[
i]) - 1;
201 for (
int j = 0; j < 4; j++) {
202 if (mask_val[j] ==
val) {
203 mask_val[
i] = mask_val[j];
214 if (
val <= 0xff ||
val == 0xffff) {
238 bool load_priv =
false;
240 if (!((p->par.clear.zero | p->par.clear.one) &
SWS_COMP(
i)))
301 case 1: coeff_veclist =
vv_1(vc[0]);
break;
302 case 2: coeff_veclist =
vv_2(vc[0], vc[1]);
break;
303 case 3: coeff_veclist =
vv_3(vc[0], vc[1], vc[2]);
break;
304 case 4: coeff_veclist =
vv_4(vc[0], vc[1], vc[2], vc[3]);
break;
315 bool overwritten[4] = {
false,
false,
false,
false };
318 for (
int j = 0; j < 5; j++) {
319 bool is_offset = (j == 0);
320 int src_j = is_offset ? 4 : (j - 1);
321 if (p->par.lin.zero &
SWS_MASK(
i, src_j))
323 uint8_t vc_i = i_coeff / 4;
324 uint8_t vc_j = i_coeff & 3;
327 if (!is_offset && overwritten[src_j])
329 overwritten[
i] =
true;
341 LOOP (save_mask,
i) { sl[
i] = tl[
i]; }
497 i_ldr(
r,
s->op0_func, impl_cont);
CMT(
"SwsFuncPtr op0_func = impl->cont;");
502 i_mov(
r,
s->impl,
s->op1_impl);
CMT(
"impl = op1_impl;");
512 bool is_read =
false;
513 bool is_write =
false;
539 size_t total_size = p->block_size * el_size;
541 s->vec_size =
FFMIN(total_size, 16);
542 s->use_vh = (
s->vec_size != total_size);
544 s->el_size = el_size;
545 s->el_count =
s->vec_size / el_size;
613 i_ldr(
r,
s->cont, impl_post);
CMT(
"SwsFuncPtr cont = (impl++)->cont;");
643 while (entries->
name) {
652 printf(
"#include \"libavutil/aarch64/asm.S\"\n");
657 fputs(bp.str, stdout);
666int main(
int argc,
char *argv[])
669 _setmode(_fileno(stdout), _O_BINARY);
static const struct @070174075374214234277303002223103136214276265127 ops_entries[]
static double val(void *priv, double ch)
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
#define AV_BPRINT_SIZE_UNLIMITED
#define i(width, name, range_min, range_max)
__device__ int printf(const char *,...)
#define FF_DYNARRAY_ADD(av_size_max, av_elt_size, av_array, av_size, av_success, av_failure)
Add an element to a dynamic array.
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
static const uint16_t mask[17]
static void asmgen_op_write_planar(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_clear(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_read_packed(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_read_nibble(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void reshape_io_vectors(SwsAArch64OpRegs *regs, int el_count, int el_size)
static void asmgen_op_write_nibble(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_move(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void reshape_temp_vectors(SwsAArch64OpRegs *regs, int el_count, int el_size)
static void asmgen_op_unpack(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void reshape_const_vectors(SwsAArch64OpRegs *regs, int el_count, int el_size)
static void asmgen_op_dither(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_process(SwsAArch64Context *s, SwsCompMask imask, SwsCompMask omask)
static void asmgen_op_lshift(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_linear(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_min(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_convert(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_swap_bytes(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_read_planar(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_expand(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_scale(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
#define LOOP_VH(s, mask, idx)
static void asmgen_op_rshift(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_read_bit(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_write_bit(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_max(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_write_packed(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_pack(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static uint16_t nibble_mask(SwsCompMask mask)
static int linear_num_vregs(const SwsAArch64OpImplParams *params)
#define LOOP_MASK(p, idx)
#define offsetof_impl_priv
#define offsetof_impl_cont
static void * av_memdup(const void *p, size_t size)
static void asmgen_setup_clear(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_setup_scale(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_setup_read_nibble(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_setup_max(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_setup_read_bit(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_common_frame(SwsAArch64Context *s, SwsCompMask imask, SwsCompMask omask)
static void asmgen_setup_linear(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_setup_write_bit(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_op_frame(SwsAArch64Context *s, SwsCompMask imask, SwsCompMask omask)
static void asmgen_setup_min(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_process_frame(SwsAArch64Context *s, SwsCompMask imask, SwsCompMask omask)
static void init_vectors_cps(SwsAArch64Context *s, SwsAArch64OpRegs *regs)
static void asmgen_set_load_cont_node(SwsAArch64Context *s)
Set node where the continuation address will be loaded and impl will be incremented.
static void asmgen_setup_unpack(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void asmgen_process_cps(SwsAArch64Context *s, SwsCompMask mask)
static void asmgen_setup_dither(SwsAArch64Context *s, const SwsAArch64OpImplParams *p, SwsAArch64OpRegs *regs)
static void * av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, const uint8_t *elem_data)
static void asmgen_op_cps(SwsAArch64Context *s, const SwsAArch64OpEntry *entry)
static const int rw_gprs[]
Register assignment for CPS functions.
RasmNode * rasm_get_current_node(RasmContext *rctx)
AArch64VecViews a64op_vec_views(RasmOp op)
void rasm_free(RasmContext **prctx)
RasmContext * rasm_alloc(void)
int rasm_func_begin(RasmContext *rctx, const char *name, bool export, bool jumpable)
RasmNode * rasm_add_comment(RasmContext *rctx, const char *comment)
void rasm_annotate_next(RasmContext *rctx, const char *comment)
RasmNode * rasm_set_current_node(RasmContext *rctx, RasmNode *node)
#define i_mov16b(rctx, op0, op1)
#define i_dup(rctx, op0, op1)
static RasmOp a64op_base(RasmOp op)
static RasmOp vv_4(RasmOp op0, RasmOp op1, RasmOp op2, RasmOp op3)
static RasmOp a64op_vec(uint8_t n)
#define i_movi(rctx, op0, op1)
static RasmOp a64op_elem(RasmOp op, uint8_t idx)
static RasmOp a64op_gpx(uint8_t n)
#define i_ld1(rctx, op0, op1)
static RasmOp v_q(RasmOp op)
static RasmOp a64op_off(RasmOp op, int16_t imm)
#define i_ldr(rctx, op0, op1)
static RasmOp vv_2(RasmOp op0, RasmOp op1)
static RasmOp v_16b(RasmOp op)
static RasmOp a64op_post(RasmOp op, int16_t imm)
#define i_add(rctx, op0, op1, op2)
#define i_ld1r(rctx, op0, op1)
void int rasm_print(RasmContext *rctx, AVBPrint *bp)
static RasmOp vv_1(RasmOp op0)
static RasmOp vv_3(RasmOp op0, RasmOp op1, RasmOp op2)
static RasmOp a64op_w(RasmOp op)
#define i_mov(rctx, op0, op1)
static RasmOp a64op_gpw(uint8_t n)
This helper structure is used to mimic the assembler syntax for vector register modifiers.
Implementation parameters for all exported functions.
SwsAArch64OpImplParams params
SwsAArch64OpImplParams describes the parameters for an SwsUOpType operation.
RasmOp linear_vcoeff[4][5]
static void error(const char *err)
Runtime assembler for AArch64.
#define SWS_COMP_ELEMS(N)
uint8_t SwsCompMask
Bit-mask of components.
static av_const int ff_sws_pixel_type_size(SwsPixelType type)