From ffa0a9e9c9cc66ec909a3a0b223b7faaebb21c50 Mon Sep 17 00:00:00 2001 From: "mikhal@webrtc.org" Date: Thu, 8 Dec 2011 22:45:53 +0000 Subject: [PATCH] updating libyuv to latest version (98). This CL also includes some additional adaptations to the code due to the upgrade. Review URL: http://webrtc-codereview.appspot.com/306001 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1139 4adac7df-926f-26a2-2b94-8c16560cd09d --- DEPS | 2 +- src/common_video/libyuv/include/libyuv.h | 5 ----- src/common_video/libyuv/libyuv.cc | 21 +++++---------------- src/common_video/libyuv/test/unit_test.cc | 3 +-- 4 files changed, 7 insertions(+), 24 deletions(-) diff --git a/DEPS b/DEPS index 788497053..01a4458bd 100644 --- a/DEPS +++ b/DEPS @@ -84,7 +84,7 @@ deps = { "http://jsoncpp.svn.sourceforge.net/svnroot/jsoncpp/trunk/jsoncpp@246", "trunk/third_party/libyuv": - (Var("googlecode_url") % "libyuv") + "/trunk@54", + (Var("googlecode_url") % "libyuv") + "/trunk@98", } deps_os = { diff --git a/src/common_video/libyuv/include/libyuv.h b/src/common_video/libyuv/include/libyuv.h index a9aa495e8..ab9070b65 100644 --- a/src/common_video/libyuv/include/libyuv.h +++ b/src/common_video/libyuv/include/libyuv.h @@ -225,11 +225,6 @@ int ConvertI420ToRGBAIPhone(const uint8_t* src_frame, int width, int height, int dst_stride); -// I420 Cut and Pad - make a center cut -int CutI420Frame(uint8_t* frame, - int src_width, int src_height, - int dst_width, int dst_height); - int I420Rotate(const uint8_t* src_frame, uint8_t* dst_frame, int width, int height, diff --git a/src/common_video/libyuv/libyuv.cc b/src/common_video/libyuv/libyuv.cc index af4d07ea7..36aa548fe 100644 --- a/src/common_video/libyuv/libyuv.cc +++ b/src/common_video/libyuv/libyuv.cc @@ -137,7 +137,7 @@ int ConvertI420ToRGBAMac(const uint8_t* src_frame, uint8_t* dst_frame, int width, int height, int dst_stride) { - // Equivalent to Convert YV12ToRGBA. + // Equivalent to Convert YV12ToBGRA. // YV12 same as I420 with U and V swapped. if (dst_stride == 0 || dst_stride == width) dst_stride = 4 * width; @@ -145,7 +145,7 @@ int ConvertI420ToRGBAMac(const uint8_t* src_frame, const uint8_t* uplane = src_frame + width * height; const uint8_t* vplane = uplane + (width * height / 4); - return libyuv::I420ToARGB(yplane, width, + return libyuv::I420ToBGRA(yplane, width, vplane, width / 2, uplane, width / 2, dst_frame, dst_stride, @@ -520,16 +520,6 @@ int ConvertYUY2ToI420(int width, int height, width, height); } -// Make a center cut -int CutI420Frame(uint8_t* frame, - int fromWidth, int fromHeight, - int toWidth, int toHeight) { - // TODO(mikhal): Verify - return libyuv::I420Crop(frame, - fromWidth, fromHeight, - toWidth, toHeight); -} - int ConvertRGB24ToARGB(const uint8_t* src_frame, uint8_t* dst_frame, int width, int height, int dst_stride) { if (dst_stride == 0 || dst_stride == width) @@ -575,15 +565,14 @@ int ConvertI420ToARGBMac(const uint8_t* src_frame, uint8_t* dst_frame, int ConvertARGBMacToI420(int width, int height, const uint8_t* src_frame, uint8_t* dst_frame) { - // Equivalent to YV12ToARGB. - // YV12 = YVU => use I420 and switch U and V. + // Equivalent to BGRAToI420 uint8_t* yplane = dst_frame; uint8_t* uplane = yplane + width * height; uint8_t* vplane = uplane + (width * height / 4); - return libyuv::ARGBToI420(src_frame, width * 4, + return libyuv::BGRAToI420(src_frame, width * 4, yplane, width, - vplane, width / 2, uplane, width / 2, + vplane, width / 2, width, height); } diff --git a/src/common_video/libyuv/test/unit_test.cc b/src/common_video/libyuv/test/unit_test.cc index d153245fe..263971c8f 100644 --- a/src/common_video/libyuv/test/unit_test.cc +++ b/src/common_video/libyuv/test/unit_test.cc @@ -99,7 +99,6 @@ TEST_F(LibYuvTest, MirrorSanityTest) { uint8_t* test_buffer1 = new uint8_t[frame_length_]; uint8_t* test_buffer2 = new uint8_t[frame_length_]; // Setting bad initial values - EXPECT_EQ(-1, MirrorI420LeftRight(test_buffer1, test_buffer2, width_, -30)); EXPECT_EQ(-1, MirrorI420LeftRight(test_buffer1, test_buffer2, -352, height_)); EXPECT_EQ(-1, MirrorI420LeftRight(NULL, test_buffer2, width_, height_)); EXPECT_EQ(-1, MirrorI420LeftRight(test_buffer1, NULL, width_, height_)); @@ -132,7 +131,7 @@ TEST_F(LibYuvTest, ConvertTest) { fwrite(res_i420_buffer, frame_length_, 1, output_file); ImagePSNRfromBuffer(orig_buffer, res_i420_buffer, width_, height_, &psnr); // Optimization Speed- quality trade-off => 45 dB only. - EXPECT_EQ(45.0, ceil(psnr)); + EXPECT_GT(ceil(psnr), 45); j++; delete [] res_rgb_buffer2;