Comments (15)
It visually looks like the sort of issue you get if you convert to BGRA but
view as ARGB. The alpha is 255 and in the position of BLUE.
ARGB is usually the format you want on OSX and IOS.
Original comment by [email protected]
on 28 Mar 2012 at 12:20
from libyuv.
On Mac OS X I'm capturing with kCVPixelFormatType_32ARGB. On iOS I'm capturing
with kCVPixelFormatType_32BGRA. Next I convert to I420. Finally I convert to
FOURCC_BGRA and view using kCGBitmapByteOrder32Big.
I'm attaching or Mac OS X example of the problem. The lower left video stream
doesn't undergo any conversion.
Original comment by [email protected]
on 28 Mar 2012 at 5:04
Attachments:
- [Screen Shot 2012-03-28 at 12.45.49 AM.png](https://storage.googleapis.com/google-code-attachments/libyuv/issue-26/comment-2/Screen Shot 2012-03-28 at 12.45.49 AM.png)
from libyuv.
It would be easier to deal with the 2 formats/platforms in 2 issues.
My understanding of the Apple ARGB types is they describe the channel order
within a 32 bit integer. That is how libyuv names work for ARGB, BGRA and ABGR.
kCVPixelFormatType_32ARGB means 'a' is the high byte of a register followed by
r,g and b in the low byte. In memory, being x86 and arm are little endian, B
is the first byte, followed by G,R and then A.
In your second screenshot, it looks like the color channel order is correct but
there is a conversion overflow/underflow?
The SSSE3 conversions from ARGB to I420 and back are supposed to saturate.
Can you disable sse2/ssse3, and if that works with C, isolate if its the
ARGBToI420 or I420ToARGB?
You can use environment variables for quick tests. export
LIBYUV_DISABLE_SSE2=1 and export LIBYUV_DISABLE_SSSE3=1
Original comment by [email protected]
on 28 Mar 2012 at 9:38
from libyuv.
I think you should be using kCVPixelFormatType_32ARGB, FOURCC_ARGB and view
using kCGBitmapByteOrder32Little?
Original comment by [email protected]
on 29 Mar 2012 at 2:41
from libyuv.
On iOS I am now using kCVPixelFormatType_32ARGB, FOURCC_ARGB and
kCGBitmapByteOrder32Little but I still get the blue image for the converted
frames. So now my problem is identical on iOS and Mac OS X. See attached.
Original comment by [email protected]
on 29 Mar 2012 at 3:04
Attachments:
- [Screenshot 2012.03.28 23.03.43.png](https://storage.googleapis.com/google-code-attachments/libyuv/issue-26/comment-5/Screenshot 2012.03.28 23.03.43.png)
from libyuv.
I'm currently re-architecting my code so if you'd like to close out this issue
that's fine. If I discover this is still an issue I'll re-open.
Original comment by [email protected]
on 1 Apr 2012 at 5:25
from libyuv.
Re dots in comment 2.
We're seeing people report that effect when using Flash 11 on OSX. But not on
Windows or with Flash 10.
Re blue in comment 5
Just an endian issue with one of the functions. libyuv is consistent
internally.
If it turns out theres a bug, I'll certainly fix it, but I think its just
confusion between OSX and libyuv naming.
Re comment6
For the camera end of things, you should normally capture YUV or MJPG. Usually
'yuvs' or '2yuv' on OSX and nv12 for iOS.
For rendering I420 or NV12 can be rendered with a shader, but converting to
ARGB is easier.
Original comment by [email protected]
on 5 Apr 2012 at 9:13
from libyuv.
[deleted comment]
from libyuv.
I've now implemented the renderer for Windows and I get blue also. So for Mac
OS X, iOS and Windows any frame data that is passed through the converter is
blue when rendered. I capture using MEDIASUBTYPE_RGB32 on Windows,
kCVPixelFormatType_32BGRA on Mac OS X and kCVPixelFormatType_32BGRA on iOS.
Here is the flow for all platforms:
Capture(RGB32 or
BGRA)->Convert(I420)->Encode(VP8)->Network(RTP)->Decode(VP8)->Convert(BGRA)->Ren
der(Direct2D or OpenGL)
If I bypass Encoding/Decoding the result is the same so I've confirmed it's not
a codec issue.
I no longer get the "blue dots" but the effect is consistent across all three
platforms.
Capturing in yuvs or 2yuv or nv12 would require re-architecting again and I'm
not certain of the benefit.
What I do not know is is the blue because of the conversion "to" or "from". I'm
about to re-route the flow to determine this.
Original comment by [email protected]
on 5 Apr 2012 at 10:41
from libyuv.
[deleted comment]
from libyuv.
I deleted my last comment because I have further information. I've confirmed
that the blue image is being caused by the "conversion to I420". Just after the
conversion I wrote a frame to disk and viewed it with GLYUVPlay and it is
indeed blue.
Original comment by [email protected]
on 6 Apr 2012 at 12:41
from libyuv.
Also I've been able to confirm that "conversion from I420 to BGRA" results in
blue frames via the same method.
So any conversion to/from I420 to/from BGRA is blue.
Original comment by [email protected]
on 6 Apr 2012 at 1:04
from libyuv.
For libyuv the type you want is ARGB, not BGRA.
MEDIASUBTYPE_RGB32 on Windows is equivalent to libyuv FOURCC_ARGB
Use ARGBToI420 or ConvertToI420(..., libyuv::FOURCC_ARGB) to convert to I420.
Use I420ToARGB or ConvertFromI420(..., libyuv::FOURCC_ARGB) to convert to ARGB.
The ARGB format names in libyuv describe the order of channels within a 32 bit
pixel. A is the most significant 8 bits in a 32 bit pixel, followed by R, G
and B in the least significant bits. In memory they are stored the opposite
order.
The advantage of capturing yuv formats (ie YUY2/yuvs) would be faster
capture/conversion, when going to I420.
Original comment by [email protected]
on 9 Apr 2012 at 4:29
from libyuv.
Thanks for your help the problem is resolved on all platforms. I do find it odd
that kCVPixelFormatType_32BGRA is actually ARGB but I understand your
explanation.
I also understand that there would be less conversions required if YUV was used
along most code paths.
Thanks Again!
Original comment by [email protected]
on 10 Apr 2012 at 1:00
from libyuv.
See Also include/libyuv/video_common.h for a list of sites that document the
formats.
http://www.fourcc.org/yuv.php
http://v4l2spec.bytesex.org/spec/book1.htm
http://developer.apple.com/quicktime/icefloe/dispatch020.html
http://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx#n
v12
Original comment by [email protected]
on 10 Apr 2012 at 6:13
- Changed state: Fixed
from libyuv.
Related Issues (20)
- ARGBToUVJRow_SSSE3 used but expected ARGBToUVJRow_AVX2 HOT 3
- NV12ToARGBRow_SSSE3 used, but should be NV12ToARGBRow_AVX2, based on I422ToARGBRow_AVX2 HOT 5
- I411ToARGBRow_SSSE3 used but expected AVX2. Adapt from I422ToARGBRow_AVX2 HOT 5
- I422ToYUY2Row_SSE2 - port to AVX2 HOT 1
- I422ToARGBRow_SSSE3 used; expected I422ToARGBRow_AVX2 HOT 5
- ScaleRowDown2Box_Odd_SSSE3 for odd source width subsampling.
- Convert16To8 for higher bit depth conversions
- Convert16ToF16 for higher bit depth conversions to half float.
- MJPGToARGB prototype in wrong header HOT 2
- Row_ name consistency HOT 3
- Signed int overflows in row_gcc.cc HOT 12
- test msan HOT 8
- rename MIPS_DSPR2 to DSPR2 HOT 2
- -DLIBYUV_DISABLE_X86=1 build HOT 2
- libyuv 'Source' shows old svn content - update or remove HOT 1
- SVN turn down HOT 1
- libyuv_neon.a library build failed in ios building HOT 2
- Android - android/test_runner.py ImportError: No module named dependency_manager HOT 4
- ARGBToRGB565 neon use vsri HOT 1
- ARGBToA
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 libyuv.