2753536587 / libyuv

Automatically exported from code.google.com/p/libyuv
0 stars 0 forks source link

I420ToRGB555 producing incorrect result? #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure if there is a bug in libyuv yet, but filing one anyway

via WebRtc, the following produces too little data.

Note that a unittest converts from I420 to 565 and back ok.
The source to I420ToRGB565 looks ok.  Is stride passed in correctly?

#include "common_video/libyuv/include/libyuv.h"
const static int width = 176;
const static int height = 144;
int main(int argc, char** argv) {
 printf("-----main-----\n");
 uint8_t src[width * height / 2 * 3];
 uint8_t dst[width * height * 2];
 FILE * fp;

 // read yuv
 fp = fopen("out.yuv", "r");
 if (!fp) {
   printf("fopen yuv error\n");
   fclose(fp);
   return 0;
 }
 fread(src, width*height*1.5, sizeof(char), fp);

 int ret;
 ret = webrtc::ConvertI420ToRGB565(src, dst, width, height);
 //ret = webrtc::ConvertI420ToARGB4444(src, dst, width, height, width\
);
 if (ret < 0)
   printf("error\n");

 // dump 565
 fp = fopen("out.565", "w");
 if (!fp) {
   printf("fopen 565 error\n");
   fclose(fp);
   return 0;
 }
 fwrite(dst, width*height*2, sizeof(char), fp);
 fclose(fp);
}

Original issue reported on code.google.com by fbarch...@google.com on 26 Apr 2012 at 1:57

GoogleCodeExporter commented 9 years ago
Hi Frank, I didn't notice you already filed one, please close issue 32, I copy 
it here.

What version of the product are you using? On what operating system?
r216. I tested on android with neon code and c code, both don't work correctly.

I'm pretty sure it's a bug either in webrtc libyuv wrapper or libyuv. 
The following code works fairly good, 
http://blog.tomgibara.com/post/132956174/yuv420-to-rgb565-conversion-in-android.

Original comment by leozw...@google.com on 26 Apr 2012 at 5:58

GoogleCodeExporter commented 9 years ago
Issue 32 has been merged into this issue.

Original comment by fbarch...@google.com on 26 Apr 2012 at 2:53

GoogleCodeExporter commented 9 years ago
I420 is used but meaning different formats, cannot consider it as a bug, close 
it.

Original comment by leozw...@google.com on 26 Apr 2012 at 9:08

GoogleCodeExporter commented 9 years ago
webrtc was passing width for the 565 stride.  Changed to width * 2 in webrtc
http://webrtc-codereview.appspot.com/541005/

Original comment by fbarch...@google.com on 1 May 2012 at 12:53