Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I420ToRGB555 producing incorrect result? #31

Closed
GoogleCodeExporter opened this issue Dec 29, 2015 · 4 comments
Closed

I420ToRGB555 producing incorrect result? #31

GoogleCodeExporter opened this issue Dec 29, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

Issue 32 has been merged into this issue.

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

@GoogleCodeExporter
Copy link
Author

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
Copy link
Author

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

  • Changed state: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant