Code Monkey home page Code Monkey logo

zpng's Introduction

zpng

Dependency on facebook/zstd.

Apply zstd compression after PNG-like filtering process.
Full HD Realtime encoding in lossless format (RGBA) is fast enough on M1 MacBook Air.

Support only co64 atom.
Note: File size limit is 4294967295bytes.

Encoding to zpng sequence

#import "zstd.h"
#import "Filter.h"
#import "QTZPNG.h"
Filter::Encoder *encoder = new Filter::Encoder(w,h,Filter::Color::RGBA);
encoder->encode(src,Filter::Color::RGBA,Filter::Type::Sub);
size_t len = ZSTD_compress(dst,(w+1)*h*encoder->bpp(),encoder->bytes(),encoder->length(),1);
QTZPNGRecorder *recorder = new QTZPNGRecorder(w,h,30,@"./zpng.mov");
recorder->add((unsigned char *)dst,len);
recorder->save();

Decoding to zpng sequence

QTZPNGParser *parser = new QTZPNGParser(@"./zpng.mov");
NSData *zpng = parser->get(0);
ZSTD_decompress(src,w*h*Filter::Color::RGBA+h,[zpng bytes],[zpng length]);
Filter::Decoder *decoder = new Filter::Decoder(w,h,Filter::RGBA);
decoder->decode(src,Filter::Color::ARGB);

Converting to QuickTime PNG sequence

Any library is required to convert to PNG.
Using stb_image_write as example.

QTZPNGParser *parser = new QTZPNGParser(@"./zpng.mov");
unsigned int bpp = parser->depth()>>3;
NSData *zpng = parser->get(0);
ZSTD_decompress(src,(w*h)*bpp+h,[zpng bytes],[zpng length]);
Filter::Decoder *decoder = new Filter::Decoder(w,h,bpp);
decoder->decode((unsigned char *)src,bpp);
int len = 0;    
unsigned char *png = stbi_write_png_to_mem((const unsigned char *)decoder->bytes(),w*bpp,w,h,bpp,&len);
QTPNGRecorder *recorder = new QTPNGRecorder(w,h,30,bpp<<3,@"./png.mov");
recorder->add(png,len);
recorder->save();

Browser Support

Support for decoding via emscripten.
https://github.com/mizt/zpng/tree/master/emscripten/

Quick Look

File Extension is zpng.

https://github.com/mizt/zpng/tree/master/QuickLook/

mdls test.zpng

Copy kMDItemContentType value to QLSupportedContentTypes in Info.plist

Premiere Pro importers

/Library/Application\ Support/Adobe/Common/Plug-ins/7.0/MediaCore/zpng_File_Import.bundle

See aloso https://github.com/fnordware/AdobeOgg/tree/theora/

Directly import in After Effects via Premiere Pro Importer.
https://github.com/mizt/zpng/tree/master/premiere/

File Extension is zpng.

char formatname[255] = "zpng";
char shortname[32] = "zpng";
char platformXten[256] = "zpng\0";
resource 'IMPT' (1000)
{
    0x7A706E67 // 'zpng'
};

Max External Object

Add jit.zpng to Bundle Identifier.

For iPhone 13 Pro

Full HD Realtime encoding is available by setting Sub filter only. https://github.com/mizt/zpng/blob/master/FastEncoder.h

-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk option is required for make.

Decoding corrupted data example

https://mizt.github.io/zpng/err/

Similar project

catid/Zpng

zpng's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

2bbb

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.