Coder Social home page Coder Social logo

metalresizepixelbuffer's Introduction

PerformancePixelBufferResize

This project is an example: How to Use Metal to resize CVPixelBuffer on the GPU.

Resize detail steps:

  • Create MTLTexture from CVPixelBuffer

  • MPSImageBilinearScale shaders scale texture for scaleToFill\scaleAspectFit\ scaleAspectFill mode

  • Copy MTLTexture to MTLBuffer

  • Create CVPixelBuffer from MTLBuffer

metalresizepixelbuffer's People

Stargazers

 avatar  avatar Xiaolin Pu avatar Andrey Denisov avatar Chinsyo avatar Jacopo Mangiavacchi avatar Aleksandr Myaots avatar Marvin Scholz avatar  avatar Arthur Darbinyan avatar  avatar Andrea Finollo avatar lu qi avatar Kristina avatar JHS avatar  avatar

Watchers

James Cloos avatar Yuanfu avatar

metalresizepixelbuffer's Issues

Crash when resizing scaleX=2, scaleY=1 in scaleToFill mode

let oneEyeWidth: CGFloat = 1920
let oneEyeHeight: CGFloat = 2160
let resizedBuffer = filter.resizeFrame(sourcePixelFrame: pixelBuffer,
                                   targetSize: MTLSize.init(width: oneEyeWidth*2, height: oneEyeHeight, depth: 0),
                                   resizeMode: .scaleToFill) {

The original pixelBuffer size is (1920, 2160) and I want to stretch it into (3840, 2160).
And it crashed with error:

-[MTLDebugBlitCommandEncoder validateCopyFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toBuffer
:destinationOffset:destinationBytesPerRow:destinationBytesPerImage:options:]
:1015: failed assertion `Copy From Buffer Validation
destinationBytesPerRow(7680) must be >= (15360).
totalBytesUsed(16596480) must be <= [destinationBuffer length](16588800).

Crash Using in Broadcast Extension

When I use the resizer in the Broadcast Upload Extension to compress the Samples Buffers I receive from ReplayKit, the extension crashes because of the Thread 6: EXC_BAD_ACCESS (code=1, address=0x0)

Any idea how to fix it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.