yuv

Deinterleave and convert float to uint16_t efficiently

北城余情 提交于 2019-12-24 11:36:43
问题 I need to deinterleave a packed image buffer (YUVA) of floats to planar buffers. I would also like to convert these float s to uint16_t , but this is really slow. My question is: How do I speed this up by using intrinsics? void deinterleave(char* pixels, int rowBytes, char *bufferY, char *bufferU, char *bufferV, char *bufferA) { // Scaling factors (note min. values are actually negative) (limited range) const float yuva_factors[4][2] = { { 0.07306f, 1.09132f }, // Y { 0.57143f, 0.57143f }, //

Creating NV12 encoded video using windows media foundation

≯℡__Kan透↙ 提交于 2019-12-24 11:27:43
问题 I was learning to create video files with raw fixed colored images using Windows Media Foundation using this tutorial http://blogs.msdn.com/b/eternalcoding/archive/2013/03/06/developing-a-winrt-component-to-create-a-video-file-using-media-foundation.aspx I was able to create RGB encoded WMV video shown in the above link. But i need to create YUV encoded MP4 video in NV12 format from image. Since NV12 use (W x H x 3/2) bytes of memory buffer for each frame, i created (W x H x 3/2) bytes of

yuv 格式

孤者浪人 提交于 2019-12-24 07:44:38
1.YUV4:4:4格式意味着Y、U、V三个分量的采集比例相同,因此在生成的图像里,每个像素的三个分量信息完整,都是8bit,也就是一个字节。YUV4:2:2格式的采样特征是在每相邻的两个像素,一个丢弃U分量,一个丢弃V分量.YUV4:2:0格式的采样特征是所有像素都保留Y分量,同一行的像素只保留U分量,或者是V分量,同一行中相邻的两个像素只保留同一个Y分量或者U分量。 2.将YUV444转换为NV12(YUV420):从偶数行(YUV444)提取U分量,且从每一偶数行(YUV444)的每四个像素提取2个U分量。同理从奇数行(YUV444)提取V分量,且从每一偶数行(YUV444)的每四个像素提取2个V分量.若将一幅格式为YUV444,分辨率为n x m的图片转换为NV12.YUV444格式图片大小M=n x m x 3.转换为NV12后大小M=3 / 2 x n x m.实现代码如下: int yuv444_to_nv12 ( unsigned char * buffer_src , int fd ) { unsigned char * yuvIn , * yuvOutput , * y_in , * u_in , * v_in , * y_output , * u_output , * v_output ; int i , j , u_count = 0 , v_count =

How to convert ARGB8888 to 420Yp8_CbCr8 in Xamarin.iOS?

喜欢而已 提交于 2019-12-24 06:34:29
问题 I am recording video using AVFoundation and has a video output configured to provide frames with the pixelformat: CVPixelFormatType.CV32BGRA. I have chosen this format since, it is easier to do cropping and other tranformation on this format than on a yuv420p frame. However the final format is needed to be CVPixelFormatType.CV420YpCbCr8BiPlanarVideoRange, hence I am now trying to use the following method from vImageConvert, but I fail to bind it properly. I am trying to access the

Access raw YUV values from JPEG with JavaScript

梦想与她 提交于 2019-12-24 04:55:30
问题 I have dynamically loaded a JPEG image into a 2D html canvas and I would like to access the raw YCbCr pixel values. From what I understand, JPEG encodes the pixel data in YCbCr, but chrome appears convert it to RGB when accessing it with getImageData(). I have tried using the RGB to YCbCr conversion calculations but it appears to be a lossy conversion as they don't map perfectly 1-to-1. Is it possible to access the raw YCbCr pixel values in JavaScript? 回答1: Yes and no. When the browser loads

YUV shader for Unity?

感情迁移 提交于 2019-12-24 03:01:56
问题 I have some (proper, planar) YUV textures in Unity, and I just want to see them for dev use. Is there actually a working YUV shader for Unity (their shader language variant) kicking around? It's simple enough conceptually to convert from YUV to RGB .. but a bit fiddly. 回答1: YUV to RGB conversion shader: Shader "Hidden/YUVtoRGB" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { // No culling or depth Cull Off ZWrite Off ZTest Always Pass { CGPROGRAM #pragma vertex vert #pragma

How to convert RGB565 to YUV420SP faster on android?

一曲冷凌霜 提交于 2019-12-23 13:07:52
问题 I need display a jpeg picture, and convert it to YUV420SP. First I use SkBitmap to parse jpeg and display it, then I use the code below to convert RGB565 to YUV420SP on android, but it spend 75ms to convert a 640*480 RGB565 picture, so anybody know the faster way to convert RGB565 to YUV420SP on android? or faster way to convert jpeg file to YUV420SP on android? // Convert from RGB to YUV420 int RGB2YUV_YR[256], RGB2YUV_YG[256], RGB2YUV_YB[256]; int RGB2YUV_UR[256], RGB2YUV_UG[256], RGB2YUV

Camera2 api Imageformat.yuv_420_888 results on rotated image

不羁岁月 提交于 2019-12-23 12:36:21
问题 Lots of questions have been made about camera2 api and RAW image format, but searching online I have still not found the answer (that's why I am here btw). I am trying to do some real-time image processing on camera-captured frames using ImageReader and setRepeatingRequest with the front-facing camera. As suggested in some previous posts, I am acquiring the image in a RAW format (specifically Imageformat.yuv_420_888) in order to have a frame-rate around 30fps: imageReader = ImageReader

NV12 format and UV plane

守給你的承諾、 提交于 2019-12-23 10:14:05
问题 i am a little confused about the NV12 format. i am looking the this page to understand the format. What i currently understand is that if you have an image or video of 640 x 480 diminsion then the Y plane will be having 640 x 480 bytes and U and V both planes have 640/2 x 480/2 . It does not mean that U plane have 640/2 x 480/2 and V plane have 640/2 x 480/2 both have only 640/2 x 480/2 bytes. so the total number of bytes in out buffer array will be. 2 is multiplied with (640/2) * (480/2)

Drawing CGImageRef in YUV

偶尔善良 提交于 2019-12-23 03:33:08
问题 I am using the code here to convert a CGImageRef into a CVPixelBufferRef on OS X . Convert UIImage to CVImageBufferRef However, I need the image to be drawn in YUV (kCVPixelFormatType_420YpCbCr8Planar) instead of RBG as it is now. Is there anyway to directly draw a CGImage in YUV colorspace? And if not, does anyone have an example for the best way to go about converting the CVPixedBufferRef from RBG into YUV ? I understand the formulas for the conversion but doing it on the CPU is painfully