Note that there are some explanatory texts on larger screens.

plurals
  1. PORBG24 can be played well on Windows, but on iOS it can't
    primarykey
    data
    text
    <p>By decoder transform H264 video to rgb24 file, it can be displayer well on Windows, but when I use UIImage to display it on UIImageView its color is not right. The code I use as this:</p> <pre><code>- (UIImage *)imageFromAVPicture:(const UInt8 *)pict width:(int)width height:(int)height { CGBitmapInfo bitmapInfo = kCGBitmapByteOrderDefault; CFDataRef data = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, pict, width*height*3,kCFAllocatorNull); CGDataProviderRef provider = CGDataProviderCreateWithCFData(data); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGImageRef cgImage = CGImageCreate(width, height, 8, 24, width*3, colorSpace, bitmapInfo, provider, NULL, YES, kCGRenderingIntentDefault); CGColorSpaceRelease(colorSpace); UIImage *image = [self scaleImage:cgImage]; //UIImage *image = [[UIImage alloc] initWithCGImage:cgImage]; CGImageRelease(cgImage); CGDataProviderRelease(provider); CFRelease(data); return image; } </code></pre> <p>But before create CGImage, add code as following, its show will be right, what following code do is transform betweent rgb and bgr.</p> <pre><code>UInt8 tmpBuff1,*tmpBuff2; tmpBuff2 = (UInt8 *)pict; for(int i =0;i&lt;height;i++) { for(int j=0;j&lt;width;j++) { tmpBuff1 = *tmpBuff2; *tmpBuff2 = *(tmpBuff2+2); *(tmpBuff2+2) = tmpBuff1; tmpBuff2 += 3; } } </code></pre> <p>After transform from rgb to bgr, its show will be right.</p> <p>So I want to know why, why the same RGB24 file can play well on PC, but wrong on iOS before transform from RGB24 to BGR24.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload