webrtc/sdk/objc/Framework/UnitTests
David Porter 25cc8ad198 Fixed issue with BGRA RTCCVPixelBuffer scale and crop
BGRA RTCCVPixelBuffers were cropped and scaled incorrectly. Libyuv’s
`ARGBScale` method is used in RTCCVPixelBuffer to scale and crop the
pixel buffer. To crop by `cropX` and `cropY` pixels, pointer
arithmetic is used to offset the src pointer of the original pixel
buffer bytes. There is a bug in how this offset is calculated.

The offset is done by `src += srcStride * _cropY + _cropX`. Libyuv
expects that the src pointer will point to the start of a new pixel.
However, if _cropX is a not a multiple of 4 (4 bytes for BGRA), the src
pointer will point to a byte in the middle of a pixel and thus libyuv
will incorrectly treat the data as the start of pixel (incorrectly
treating the first byte as red when it is actually green, etc...). To
fix this, the src pointer needs to be offset to always point to the
start of a new pixel.

Before this change:

Original Test Gradient image with a cropX of 2:
https://i.imgur.com/gSIgwGV.jpg

Scaled image (notice the colors are incorrect):
https://i.imgur.com/oPxbTEK.jpg

After this change:

Scaled image (notice the colors are correct):
https://i.imgur.com/dqBsmsH.jpg

A new unit test which tests scaling with cropX and cropY values has been
added. The test fails without this change and now passes with the
correct src pointer offsetting.

Bug: webrtc:9555
Change-Id: I87cbd7b91bc139d51fb4e11cc50ccb014cfa8051
Reviewed-on: https://webrtc-review.googlesource.com/89220
Commit-Queue: Kári Helgason <kthelgason@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24076}
2018-07-24 08:23:26 +00:00
..
audio_short16.pcm Moving iOS Audio Device to sdk. 2018-05-15 10:33:01 +00:00
audio_short44.pcm Moving iOS Audio Device to sdk. 2018-05-15 10:33:01 +00:00
audio_short48.pcm Moving iOS Audio Device to sdk. 2018-05-15 10:33:01 +00:00
avformatmappertests.mm
foreman.mp4 Reland "Add file capturer to AppRTCMobile on simulator." 2017-11-24 15:06:39 +00:00
frame_buffer_helpers.h Reland "Add unit tests for RTCCVPixelBuffer and ObjCVideoTrackSource." 2018-04-03 11:35:40 +00:00
frame_buffer_helpers.mm Quick Look in the Xcode Debugger for Obj-C frame buffer classes. 2018-04-05 12:25:23 +00:00
main.m Add xctest target to migrate sdk/objc/Framework to it. 2017-10-13 14:19:32 +00:00
objc_video_decoder_factory_tests.mm Deprecate RTPFragmentationHeader argument to VideoDecoder::Decode 2018-05-08 08:09:35 +00:00
objc_video_encoder_factory_tests.mm ObjC SDK: Stop using built-in SW video codecs 2018-05-02 10:15:56 +00:00
ObjCVideoTrackSource_xctest.mm Setting resolution alignment to 4 on iOS. 2018-06-08 14:17:07 +00:00
RTCAudioDevice_xctest.mm Moving iOS Audio Device to sdk. 2018-05-15 10:33:01 +00:00
RTCAudioDeviceModule_xctest.mm Moving iOS Audio Device to sdk. 2018-05-15 10:33:01 +00:00
RTCAudioSessionTest.mm Adding a KVO context to avoid issues with future super/sub-classing. 2017-10-23 12:33:17 +00:00
RTCCallbackLogger_xctest.m Add unittest for default severity level of RTCCallbackLogger 2018-07-10 20:10:56 +00:00
RTCCameraVideoCapturerTests.mm iOS SDK 10.0 compatability. 2018-05-31 07:28:34 +00:00
RTCConfigurationTest.mm
RTCCVPixelBuffer_xctest.mm Fixed issue with BGRA RTCCVPixelBuffer scale and crop 2018-07-24 08:23:26 +00:00
RTCDataChannelConfigurationTest.mm
RTCDoNotPutCPlusPlusInFrameworkHeaders_xctest.m Generate iOS framework umbrella header. 2018-01-15 13:43:59 +00:00
RTCFileVideoCapturer_xctest.mm Reland "Add file capturer to AppRTCMobile on simulator." 2017-11-24 15:06:39 +00:00
RTCH264ProfileLevelId_xctest.m Obj-C SDK for parsing and generating H264 ProfileLevelIds. 2018-06-01 11:23:31 +00:00
RTCIceCandidateTest.mm
RTCIceServerTest.mm
RTCIntervalRangeTests.mm
RTCMediaConstraintsTest.mm
RTCMTLVideoView_xctest.m Make MTLView content mode settable. 2018-04-20 15:37:23 +00:00
RTCPeerConnectionFactory_xctest.m Fixed crash when PCF is destroyed before MediaSource/Track in ObjC 2018-07-16 12:03:16 +00:00
RTCPeerConnectionFactoryBuilderTest.mm Create a peer connection factory builder 2018-06-21 09:22:50 +00:00
RTCPeerConnectionTest.mm Add a flag to actively reset the SRTP parameters 2018-06-12 20:32:00 +00:00
RTCSessionDescriptionTest.mm
RTCTracingTest.mm
scoped_cftyperef_tests.mm Add tests for ScopedCFTypeRef. 2017-10-05 12:36:31 +00:00