Skip to content

Instantly share code, notes, and snippets.

View awxkee's full-sized avatar

Radzivon Bartoshyk awxkee

  • Batumi
View GitHub Profile
@awxkee
awxkee / gist:3984202f200a660686ea02839d020265
Last active September 7, 2026 14:31
small_test_jxl.txt
Distance 1 (4992662 bytes)
3961x5942, 8-bit RGBA, 94145048 samples, alpha: false, ICC: 504 bytes
Iteration 1: 519.25 ms
Iteration 2: 511.83 ms
Iteration 3: 531.22 ms
Average at distance 1: 520.77 ms
Distance 2 (3629673 bytes)
3961x5942, 8-bit RGBA, 94145048 samples, alpha: false, ICC: 504 bytes
@awxkee
awxkee / subnormals.rs
Created August 9, 2026 20:23
subnormals
use core::arch::x86_64::*;
#[target_feature(enable = "avx2")]
pub fn mul_add_precise_f32x4(a: __m128, b: __m128, c: __m128) -> __m128 {
let a_low = _mm_cvtps_pd(a);
let a_high = _mm_cvtps_pd(_mm_movehl_ps(a, a));
let b_low = _mm_cvtps_pd(b);
let b_high = _mm_cvtps_pd(_mm_movehl_ps(b, b));
let c_low = _mm_cvtps_pd(c);
let c_high = _mm_cvtps_pd(_mm_movehl_ps(c, c));
@awxkee
awxkee / gist:f0ca570397166bcee89e78df6c79f26e
Last active August 2, 2026 10:56
jixel perf estimate
---------------------------------------------- x86_64 ---
./assets/digital_art_portrait.jpg: 2736x4104, quality 75, 24 threads, 7 measured iterations
jixel: Slow; libjxl: effort 7
jixel median 574.42 ms min 533.91 ms mean 575.18 ms 19.5 MP/s 741819 bytes
libjxl median 626.64 ms min 618.86 ms mean 634.77 ms 17.9 MP/s 1159900 bytes
speed: jixel is 1.09x faster than libjxl
---
@awxkee
awxkee / jxl_rs_fuzz.rs
Created July 19, 2026 17:40
jxl_rs_fuzz.rs
use afl::fuzz;
use jxl::api::{
Endianness, JxlColorType, JxlDataFormat, JxlDecoder, JxlDecoderOptions, JxlPixelFormat,
ProcessingResult,
};
use jxl::headers::extra_channels::ExtraChannel;
use jxl::image::JxlOutputBuffer;
use thiserror::Error;
#[derive(Debug, Error)]
@awxkee
awxkee / decoding_jxl.rs
Last active May 24, 2026 19:56
decoding_jxl.rs
/*
* Copyright (c) Radzivon Bartoshyk 5/2026. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
pub struct AutoAligner<T: Sized, const N: usize> {
pub width: usize,
pub height: usize,
pub data: Vec<T>,
}
impl<T: Sized + Default + Clone + Copy, const N: usize> AutoAligner<T, N> {
pub fn new(width: usize, height: usize, data: Vec<T>) -> AutoAligner<T, N> {
let row_size = width * N * size_of::<T>();
@awxkee
awxkee / sixth_root.rs
Last active September 12, 2025 21:07
Sixth root
/*
Copyright 2024 Radzivon Bartoshyk
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@awxkee
awxkee / bilinear_yuv.rs
Last active June 15, 2025 08:53
Bilinear YUV upsampling
/*
* Copyright (c) Radzivon Bartoshyk, 6/2025. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
trait StreamingIO: Read + Seek {}
struct IODynWrapper {
cursor: Box<dyn StreamingIO>,
buffer: Vec<u8>,
position: usize,
}
impl Read for IODynWrapper {
#[inline]
@awxkee
awxkee / histogram.rs
Last active January 19, 2025 22:52
Dynamic Image Histogram
use image::{DynamicImage, ImageReader};
use num_traits::AsPrimitive;
use std::fmt::Debug;
#[derive(Clone, Debug)]
pub struct ImageStatistics<A: Clone + Debug> {
pub hist_bins: Vec<Vec<A>>,
pub distinct_colors: u64,
}