Comments (6)
Your terminology is extremely confusing and alien, could you explain in simple terms?
Do you mean planar instead of interleaved?
from wuffs.
@pjanx I am sorry for that. You are right, I mean separated planes.
That's very important in many Deep Learning applications now (for example PyTorch or TensorRT use this format). However, conversation interleaved -> planar is not cheap (for example, with cv::split).
from wuffs.
See usages of wuffs_base__pixel_format__is_planar()
and wuffs_base__pixel_buffer__plane()
--no, it's not currently supported.
Your best option in the foreseeable future is to do some custom post-processing, which will also give you flexibility with the bit depth, and with the choice of channels. Understand that image formats are wild--the input may be indexed (GIF, PNG), RGB/A interleaved (PNG), or even YCbCr planar with differently sized planes (lossy formats, 4:2:2 and 4:2:0). That's a lot of paths to care about. There are bigger concerns in the image library right now.
from wuffs.
Yeah, custom post-processing is the way to go for now.
I'm surprised that HWC <-> CWH conversion isn't cheap (if HWC and CWH mean what I think it means; I've never seen those terms before today). I'm not very familiar with PyTorch or TensorRT, but it should be very SIMD friendly.
How do existing PyTorch or TensorRT programs load (and convert) PNGs? Do they use libpng? I don't see any PNG_TRANSFORM_FOOBAR definitions in libpng to split into separate R, G, B, A planes, so I'm guessing it'd have to be a post-processing step. Can you just do the same post-processing step?
from wuffs.
I'm not sure what they use, but OpenCV has optimized enough split function for cpu and cuda.
However, copy is still copy. It can be avoided in theory and on big images difference isn't small.
But thanks for answers
from wuffs.
For what it's worth, it's a valid request, but unlikely to be fulfilled, unless someone would step in to work on it themselves.
Another thought: if you don't control the image source, you may want to colour manage the images, which means extra processing anyway. And if you do, you may want to pre-normalize it to whatever format is seen fit.
from wuffs.
Related Issues (20)
- Slow f64 parsing HOT 13
- RGB/BGR 16 bit treated like RGBA/BGRA? HOT 1
- OSS-Fuzz issue 59018 HOT 1
- [JPEG] unsupported DQT after SOF markers HOT 1
- OSS-Fuzz issue 59182 HOT 1
- OSS-Fuzz issue 59540 HOT 1
- OSS-Fuzz issue 59966 HOT 1
- A question regarding auxiliary C++ API HOT 4
- What is the status of version 0.3? HOT 3
- Empty slice manipulation triggers UBSAN by offsetting from a null pointer. HOT 2
- error: conversion to ‘uint32_t’ {aka ‘unsigned int’} from ‘int’ may change the sign of the result HOT 3
- OSS-Fuzz issue 66816 HOT 1
- PNG's are stored in RGB order but Wuffs returns BGR/BGRA? HOT 1
- Decode PNG with gray+alpha as 2 channels (i.e. YA not BGRA) HOT 5
- Warning about always true comparison of integers HOT 1
- std/crc64 doesn't build for 32-bit x86 HOT 1
- Allowing LA and RGBA PNGs with a tRNS chunk HOT 2
- How to get the correct 'transparency' value in the DecodeImage API? HOT 2
- wuffs 0.4 significantly slower than 0.3 decoding PNGs HOT 27
- wuffs significantly slower than OpenCV 4.9.0 when decoding PNGs for 7680x4320 image HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wuffs.