This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait StreamingIO: Read + Seek {} | |
struct IODynWrapper { | |
cursor: Box<dyn StreamingIO>, | |
buffer: Vec<u8>, | |
position: usize, | |
} | |
impl Read for IODynWrapper { | |
#[inline] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const REDUCTION_TABLE: [[u32; 2]; 255] = [ | |
[0, 0], | |
[0, 1], | |
[43691, 1], | |
[0, 2], | |
[52429, 2], | |
[43691, 2], | |
[9363, 66], | |
[0, 3], | |
[58255, 3], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.android.example.rsmigration | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.opengl.EGL14 | |
import android.opengl.EGL15 | |
import android.opengl.EGLConfig | |
import android.opengl.EGLContext | |
import android.opengl.EGLDisplay | |
import android.opengl.EGLExt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.simpleegl | |
import android.app.ActivityManager | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.opengl.EGL14 | |
import android.opengl.EGL15 | |
import android.opengl.EGLConfig | |
import android.opengl.EGLContext | |
import android.opengl.EGLDisplay |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <jni.h> | |
#include <android/bitmap.h> | |
#include <vector> | |
#include "JniExceptions.h" | |
#include "XScaler.h" | |
#include "Rgb1010102toF16.h" | |
#include "RGBAlpha.h" | |
#include "libyuv/convert_argb.h" | |
#include "libyuv/convert_from_argb.h" | |
#include "CopyUnaligned.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import avifc | |
public class SDWebImageAVIFAnimatedCoder: NSObject, SDAnimatedImageCoder { | |
private let decoder: AVIFAnimatedDecoder | |
public required init?(animatedImageData data: Data?, options: [SDImageCoderOption : Any]? = nil) { | |
guard let data, let mDecoder = AVIFAnimatedDecoder(data: data) else { | |
return nil | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import avifc | |
Task(priority: .high) { | |
let animationAvifUrl = Bundle.main.url(forResource: "animation_6", withExtension: "avif")! | |
var data = try! Data(contentsOf: animationAvifUrl) | |
let animationDecoder = AVIFAnimatedDecoder(data: data)! | |
let framesCount = animationDecoder.framesCount() | |
var currentFrame = framesCount | |
while (true) { | |
if currentFrame >= framesCount { |