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

NV21 U and V are reversed for android #20

Closed
GoogleCodeExporter opened this issue Sep 16, 2015 · 4 comments
Closed

NV21 U and V are reversed for android #20

GoogleCodeExporter opened this issue Sep 16, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. run libyuv use on android galaxy S2
2. make sure NV21 format is used
3.

What is the expected output? What do you see instead?
expect to see color as needed, actually see mostly blue. for instance human 
skin is blue.

What version of the product are you using? On what operating system?
android 2.3.3
watch code at:
http://code.google.com/p/libyuv/source/browse/trunk/source/convert.cc?spec=svn17
0&r=170


Please provide any additional information below.
the code problem is that there is a comment to swap the u and v but they are 
not swapped:

    case FOURCC_NV21:
      src = sample + (src_width * crop_y + crop_x);
      src_uv = sample + aligned_src_width * (src_height + crop_y / 2) + crop_x;
      // Call NV12 but with u and v parameters swapped.
      NV12ToI420Rotate(src, src_width,
                       src_uv, aligned_src_width,
                       y, y_stride,
                       u, u_stride,
                       v, v_stride,
                       dst_width, inv_dst_height, rotation);

should be:

    case FOURCC_NV21:
      src = sample + (src_width * crop_y + crop_x);
      src_uv = sample + aligned_src_width * (src_height + crop_y / 2) + crop_x;
      // Call NV12 but with u and v parameters swapped.
      NV12ToI420Rotate(src, src_width,
                       src_uv, aligned_src_width,
                       y, y_stride,
                       v, v_stride,
                       u, u_stride,
                       dst_width, inv_dst_height, rotation);

Original issue reported on code.google.com by biai...@gmail.com on 15 Mar 2012 at 10:29

@GoogleCodeExporter
Copy link
Author

Thats been fixed in r208.  See Also issue 17
http://code.google.com/p/libyuv/issues/detail?id=17
Current version is r216
http://code.google.com/p/libyuv/source/browse/trunk/source/convert.cc?spec=svn21
6&r=216
and r214 is in Chromium tree.
Can you confirm you're able to update to one of those versions?

Original comment by fbarch...@google.com on 15 Mar 2012 at 9:52

  • Changed title: NV21 U and V are reversed for android
  • Changed state: Started

@GoogleCodeExporter
Copy link
Author

Hi,
i am able to download the latest version, but unfortunately i need it as part 
of the webrtc project for android.
in there the version that is currently checked out is 192.
i checked out the webrtc code through:
http://www.webrtc.org/reference/getting-started.;
please sync it to libyuv latest build. if you need me to open an issue on the 
webrtc project please let me know.
in the meantime, i will probably change it manually.

thanks,
Itay

Original comment by biai...@gmail.com on 18 Mar 2012 at 8:39

@GoogleCodeExporter
Copy link
Author

On my side I confirm that r208 correctly fixes that as said in issue 17.

@Itay : you should consider building webRTC without depending on gyp. 

That's what I do in CSipSimple to be more free to update each part of webRTC 
independantly (and actually on my side it's even more interesting because I 
don't need all webRTC stuff).
As far as I understood the support of android is not official in webRTC for 
now, it seems to be done in best effort. So probably in first step you should 
ensure that you can keep a complete hand on their code. 
I also use quilt to be able to patch potential regressions / incompatibility 
introduced in webRTC regarding android. 
If you are interested in it : 
http://code.google.com/p/csipsimple/source/browse/trunk/CSipSimple#CSipSimple%2F
jni%2Fwebrtc%2Fpatches


Original comment by r3gis...@gmail.com on 19 Mar 2012 at 10:10

@GoogleCodeExporter
Copy link
Author

I've asked the webrtc team to update.  Should happen within a week.
Closing as fixed, since libyuv r208 is working as expected.

Original comment by fbarch...@google.com on 20 Mar 2012 at 8:52

  • Changed state: Fixed

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