Skip to content

Instantly share code, notes, and snippets.

View zintus's full-sized avatar

Alexey Zinchenko zintus

View GitHub Profile
import XCTest
class PerformanceTest: XCTestCase {
func testString() { // 0.265s on iPhone X
var array = [String]()
let strings = Array(1 ... 1_000_000).map { String($0) }
measure {
strings.forEach {
array.append($0)
}
@zintus
zintus / libyuv.cc
Last active November 11, 2017 09:56
Update CVImageBufferRef with pixels in capture format with bgra pixels using libyuv
// Function to update image buffer in NV12 format with BGRA pixel buffer
// Assumptions:
// bgra buffer is 32bpp
// bgra buffer width and height equal to imageBuffer
// bgra buffer stride is equal to imageBuffer width
int UpdateSampleBufferWithBGRAPixels(CVImageBufferRef imageBuffer, void *bgraPixels) {
const OSType pixelFormat = CVPixelBufferGetPixelFormatType(imageBuffer);
assert(pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarFullRange || pixelFormat == kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange);
const size_t width = CVPixelBufferGetWidth(imageBuffer);
using UnityEngine;
using System.Collections.Generic;
using Voximplant;
public class Conference : MonoBehaviour
{
VoximplantSDK vox;
public GameObject quad;