Android: Add tests for VideoFrame.Buffer.toI420() and cropAndScale()
This CL adds tests that are primarily targeting VideoFrame.Buffer.toI420() and cropAndScale(), but includes the whole chain for YuvConverter, GlRectDrawer, and VideoFrameDrawer. It also includes a couple of fixes to bugs that were exposed by the new tests. Bug: webrtc:9186, webrtc:9391 Change-Id: I5eb62979a8fd8def28c3cb2e82dcede57c42216f Reviewed-on: https://webrtc-review.googlesource.com/83163 Commit-Queue: Magnus Jedvert <magjed@webrtc.org> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23611}
This commit is contained in:
committed by
Commit Bot
parent
d1f970dc43
commit
6507054db1
@ -85,7 +85,10 @@ public class TextureBufferImpl implements VideoFrame.TextureBuffer {
|
||||
public VideoFrame.Buffer cropAndScale(
|
||||
int cropX, int cropY, int cropWidth, int cropHeight, int scaleWidth, int scaleHeight) {
|
||||
final Matrix newMatrix = new Matrix(transformMatrix);
|
||||
newMatrix.preTranslate(cropX / (float) width, cropY / (float) height);
|
||||
// In WebRTC, Y=0 is the top row, while in OpenGL Y=0 is the bottom row. This means that the Y
|
||||
// direction is effectively reversed.
|
||||
final int cropYFromBottom = height - (cropY + cropHeight);
|
||||
newMatrix.preTranslate(cropX / (float) width, cropYFromBottom / (float) height);
|
||||
newMatrix.preScale(cropWidth / (float) width, cropHeight / (float) height);
|
||||
|
||||
retain();
|
||||
|
||||
Reference in New Issue
Block a user