| Index: webrtc/media/base/videocommon_unittest.cc
|
| diff --git a/webrtc/media/base/videocommon_unittest.cc b/webrtc/media/base/videocommon_unittest.cc
|
| index 84a728b19b14da8b5e45efd3657da7faaac6cf29..b711c43569b312509dbb6229052674cd772ee237 100644
|
| --- a/webrtc/media/base/videocommon_unittest.cc
|
| +++ b/webrtc/media/base/videocommon_unittest.cc
|
| @@ -166,146 +166,4 @@ TEST(VideoCommonTest, MAYBE_TestComputeScaleWithHighFps) {
|
| EXPECT_EQ(2048, scaled_height);
|
| }
|
|
|
| -TEST(VideoCommonTest, TestComputeCrop) {
|
| - int cropped_width, cropped_height;
|
| -
|
| - // Request 16:9 to 16:9. Expect no cropping.
|
| - ComputeCrop(1280, 720, // Crop size 16:9
|
| - 640, 360, // Frame is 4:3
|
| - 1, 1, // Normal 1:1 pixels
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(360, cropped_height);
|
| -
|
| - // Request 4:3 to 16:9. Expect vertical.
|
| - ComputeCrop(640, 360, // Crop size 16:9
|
| - 640, 480, // Frame is 4:3
|
| - 1, 1, // Normal 1:1 pixels
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(360, cropped_height);
|
| -
|
| - // Request 16:9 to 4:3. Expect horizontal crop.
|
| - ComputeCrop(640, 480, // Crop size 4:3
|
| - 640, 360, // Frame is 16:9
|
| - 1, 1, // Normal 1:1 pixels
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(480, cropped_width);
|
| - EXPECT_EQ(360, cropped_height);
|
| -
|
| - // Request 16:9 but VGA has 3:8 pixel aspect ratio. Expect no crop.
|
| - // This occurs on HP4110 on OSX 10.5/10.6/10.7
|
| - ComputeCrop(640, 360, // Crop size 16:9
|
| - 640, 480, // Frame is 4:3
|
| - 3, 8, // Pixel aspect ratio is tall
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(480, cropped_height);
|
| -
|
| - // Request 16:9 but QVGA has 15:11 pixel aspect ratio. Expect horizontal crop.
|
| - // This occurs on Logitech B910 on OSX 10.5/10.6/10.7 in Hangouts.
|
| - ComputeCrop(640, 360, // Crop size 16:9
|
| - 320, 240, // Frame is 4:3
|
| - 15, 11, // Pixel aspect ratio is wide
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(312, cropped_width);
|
| - EXPECT_EQ(240, cropped_height);
|
| -
|
| - // Request 16:10 but QVGA has 15:11 pixel aspect ratio.
|
| - // Expect horizontal crop.
|
| - // This occurs on Logitech B910 on OSX 10.5/10.6/10.7 in gmail.
|
| - ComputeCrop(640, 400, // Crop size 16:10
|
| - 320, 240, // Frame is 4:3
|
| - 15, 11, // Pixel aspect ratio is wide
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(280, cropped_width);
|
| - EXPECT_EQ(240, cropped_height);
|
| -
|
| - // Request 16:9 but VGA has 6:5 pixel aspect ratio. Expect vertical crop.
|
| - // This occurs on Logitech QuickCam Pro C9000 on OSX
|
| - ComputeCrop(640, 360, // Crop size 16:9
|
| - 640, 480, // Frame is 4:3
|
| - 6, 5, // Pixel aspect ratio is wide
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(432, cropped_height);
|
| -
|
| - // Request 16:10 but HD is 16:9. Expect horizontal crop.
|
| - // This occurs in settings and local preview with HD experiment.
|
| - ComputeCrop(1280, 800, // Crop size 16:10
|
| - 1280, 720, // Frame is 4:3
|
| - 1, 1, // Pixel aspect ratio is wide
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(1152, cropped_width);
|
| - EXPECT_EQ(720, cropped_height);
|
| -
|
| - // Request 16:9 but HD has 3:4 pixel aspect ratio. Expect vertical crop.
|
| - // This occurs on Logitech B910 on OSX 10.5/10.6.7 but not OSX 10.6.8 or 10.7
|
| - ComputeCrop(1280, 720, // Crop size 16:9
|
| - 1280, 720, // Frame is 4:3
|
| - 3, 4, // Pixel aspect ratio is wide
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(1280, cropped_width);
|
| - EXPECT_EQ(540, cropped_height);
|
| -
|
| - // Request 16:9 to 3:4 (portrait). Expect no cropping.
|
| - ComputeCrop(640, 360, // Crop size 16:9
|
| - 640, 480, // Frame is 3:4 portrait
|
| - 1, 1, // Normal 1:1 pixels
|
| - 90,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(480, cropped_height);
|
| -
|
| - // Request 9:16 from VGA rotated (portrait). Expect crop.
|
| - ComputeCrop(360, 640, // Crop size 9:16
|
| - 640, 480, // Frame is 3:4 portrait
|
| - 1, 1, // Normal 1:1 pixels
|
| - 90,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(640, cropped_width);
|
| - EXPECT_EQ(360, cropped_height);
|
| -
|
| - // Cropped size 0x0. Expect no cropping.
|
| - // This is used when adding multiple capturers
|
| - ComputeCrop(0, 0, // Crop size 0x0
|
| - 1024, 768, // Frame is 3:4 portrait
|
| - 1, 1, // Normal 1:1 pixels
|
| - 0,
|
| - &cropped_width, &cropped_height);
|
| - EXPECT_EQ(1024, cropped_width);
|
| - EXPECT_EQ(768, cropped_height);
|
| -}
|
| -
|
| -TEST(VideoCommonTest, TestComputeScaleToSquarePixels) {
|
| - int scaled_width, scaled_height;
|
| -
|
| - // Pixel aspect ratio is 4:3. Logical aspect ratio is 16:9. Expect scale
|
| - // to square pixels with physical aspect ratio of 16:9.
|
| - ComputeScaleToSquarePixels(640, 480,
|
| - 4, 3, // 4 x 3 pixel aspect ratio
|
| - &scaled_width, &scaled_height);
|
| - EXPECT_EQ(640, scaled_width);
|
| - EXPECT_EQ(360, scaled_height);
|
| -
|
| - // Pixel aspect ratio is 3:8. Physical aspect ratio is 4:3. Expect scale
|
| - // to square pixels with logical aspect ratio of 1:2.
|
| - // Note that 640x1280 will be scaled down by video adapter to view request
|
| - // of 640*360 and will end up using 320x640.
|
| - ComputeScaleToSquarePixels(640, 480,
|
| - 3, 8, // 4 x 3 pixel aspect ratio
|
| - &scaled_width, &scaled_height);
|
| - EXPECT_EQ(640, scaled_width);
|
| - EXPECT_EQ(1280, scaled_height);
|
| -}
|
| -
|
| } // namespace cricket
|
|
|