Skip to content

Instantly share code, notes, and snippets.

View 3outeille's full-sized avatar
🎯
https://www.youtube.com/watch?v=VYPi0qcHWvQ&ab_channel=ABANIMETION

Ferdinand Mom 3outeille

🎯
https://www.youtube.com/watch?v=VYPi0qcHWvQ&ab_channel=ABANIMETION
View GitHub Profile
@3outeille
3outeille / parse_hackmd.md
Last active January 26, 2022 19:48
Standalone script which parse hackmd markdown (including imgur link) and create directory (from tags) with downloaded imgur link
  • Developped under Python 3.7.12
  • Standalone script which parse hackmd markdown (including imgur link) and create directory (from tags) with downloaded imgur link
  • To use, python3 script.py --zip_file <file.zip>
  • To export your hackmd markdown as zip file
@3outeille
3outeille / Makefile
Last active June 12, 2022 15:04
x86_64 SSE4 dot_product between {1, 2, 3, 4, 5, 6, 7, 8} and {10, 20, 30, 40, 50, 60, 70, 80}
NAME = libasm.a
SRCS = dot_product.asm
OBJS = $(SRCS:.asm=.o)
all:
nasm -g -f elf64 ${SRCS}
gcc -g -c main.c -o main.o
ar rc $(NAME) $(OBJS)
gcc -g main.o $(NAME) -o main
@3outeille
3outeille / Makefile
Created July 25, 2022 09:33
attempt to print something with x86inc.asm
NAME = libasm.a
SRCS = fill_mat.asm
OBJS = $(SRCS:.asm=.o)
all:
nasm -g -f elf64 ${SRCS}
gcc -g -c main.c -o main.o
ar rc $(NAME) $(OBJS)
gcc -g main.o $(NAME) -o main
@3outeille
3outeille / Makefile
Last active July 29, 2022 06:59
block average sse4 asm attempt
NAME = libasm.a
SRCS = block_avg.asm
OBJS = $(SRCS:.asm=.o)
all:
nasm -g -f elf64 ${SRCS}
gcc -g -c main.c -o main.o
ar rc $(NAME) $(OBJS)
gcc -g main.o $(NAME) -o main
@3outeille
3outeille / Makefile
Last active September 3, 2022 14:07
register sum weird results
all:
nasm -f elf64 main.asm
gcc -g -nostartfiles -no-pie -o main main.o
debug:
echo "dashboard -output /dev/pts/0\nb _start\nrun >> gdb-log.txt 2>&1\nlayout asm\ndashboard assembly\ndashboard source\ndashboard threads\nset logging file gdb-log.txt\nset logging on\nset trace-commands on\nrecord\n" > gdb-commands.txt
gdb -x gdb-commands.txt main
clean:
rm *.o main gdb-commands.txt gdb-log.txt .gdb_history
@3outeille
3outeille / prologue.asm
Last active September 6, 2022 14:51
Macro expansion to understand how C function calls x86inc function
%define ARCH_X86_64 1
; sad_16x16, 4, 7, 5, src, src_stride, dst, dst_stride, src_stride3, dst_stride3, cnt
; function_name, #args (%1), #regs (%2), #xmm_regs (%3), [stack_size,] (%4) arg_names... (%5-*)
%macro PUSH_IF_USED 1-*
%rep %0
%if %1 < regs_used
push r%1
%endif
@3outeille
3outeille / bench.c
Last active September 6, 2022 14:40
gsoc gist
struct BenchWrapper
{
size_t nb_fct_call;
size_t iter_per_fct;
// Define function arguments here
int (*func)(const OVSEI *sei, OVFrame **frame);
};
void bench_decorator(struct BenchWrapper bw, char* name, const OVSEI *sei, OVFrame **frame)
{
@3outeille
3outeille / fg_simulate_grain_blk8x8.c
Created September 6, 2022 17:53
fg_simulate_grain_blk8x8
void fg_simulate_grain_blk8x8(int32_t *grainStripe, uint32_t grainStripeOffsetBlk8,
uint32_t width, uint8_t log2ScaleFactor, int16_t scaleFactor, uint32_t kOffset, uint32_t lOffset, uint8_t h, uint8_t v, uint32_t xSize)
{
uint32_t k, l;
uint32_t idx, idx_offset, idx_offset_l, grainStripeOffsetBlk8_l;
idx_offset = ( h*NUM_CUT_OFF_FREQ + v ) * DATA_BASE_SIZE * DATA_BASE_SIZE;
for (l = 0; l < 8; l++) /* y direction */
{
idx_offset_l = idx_offset + (l + lOffset) * DATA_BASE_SIZE;
@3outeille
3outeille / fg_simulate_grain_blk8x8_sse4.c
Created September 6, 2022 17:55
fg_simulate_grain_blk8x8 sse4
void fg_simulate_grain_blk8x8_sse4(int32_t *grainStripe, uint32_t grainStripeOffsetBlk8,
uint32_t width, uint8_t log2ScaleFactor, int16_t scaleFactor, uint32_t kOffset, uint32_t lOffset, uint8_t h, uint8_t v, uint32_t xSize)
{
uint32_t idx_offset_l1, idx_offset_l2, idx_offset_l3, idx_offset_l4;
uint32_t grainStripeOffsetBlk8_l1, grainStripeOffsetBlk8_l2, grainStripeOffsetBlk8_l3, grainStripeOffsetBlk8_l4;
uint32_t idx_offset = ( h*NUM_CUT_OFF_FREQ + v ) * DATA_BASE_SIZE * DATA_BASE_SIZE;
__m128i scale = _mm_set_epi32(scaleFactor, scaleFactor, scaleFactor, scaleFactor);
@3outeille
3outeille / fg_blend_stripe.c
Created September 6, 2022 18:07
fg_blend_stripe
static inline uint32_t ov_clip_uintp2(int32_t val, uint32_t a)
{
if (val > 0) {
int32_t mask = (1 << a) - 1;
int32_t overflow = !!(val & (~mask));
return ((-overflow) & mask) | (val & mask);
} else {
return 0;
}
#if 0