Add unscaled getWidth/Height to TextureBuffer interface

Bug: b/289762633
Change-Id: I36a8c108ca03d464cd4dd08441dc9b64077343c1
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/316860
Commit-Queue: Magnus Jedvert <magjed@webrtc.org>
Reviewed-by: Fabian Bergmark <fabianbergmark@google.com>
Cr-Commit-Position: refs/heads/main@{#40567}
This commit is contained in:
Magnus Jedvert 2023-08-18 13:10:36 +02:00 committed by WebRTC LUCI CQ
parent 31251fa817
commit 70483a59aa
2 changed files with 18 additions and 8 deletions

View File

@ -140,18 +140,12 @@ public class TextureBufferImpl implements VideoFrame.TextureBuffer {
(int) Math.round(unscaledHeight * cropHeight / (float) height), scaleWidth, scaleHeight);
}
/**
* Returns the width of the texture in memory. This should only be used for downscaling, and you
* should still respect the width from getWidth().
*/
@Override
public int getUnscaledWidth() {
return unscaledWidth;
}
/**
* Returns the height of the texture in memory. This should only be used for downscaling, and you
* should still respect the height from getHeight().
*/
@Override
public int getUnscaledHeight() {
return unscaledHeight;
}

View File

@ -146,6 +146,22 @@ public class VideoFrame implements RefCounted {
Matrix transformMatrix, int newWidth, int newHeight) {
throw new UnsupportedOperationException("Not implemented");
}
/**
* Returns the width of the texture in memory. This should only be used for downscaling, and you
* should still respect the width from getWidth().
*/
default public int getUnscaledWidth() {
return getWidth();
}
/**
* Returns the height of the texture in memory. This should only be used for downscaling, and
* you should still respect the height from getHeight().
*/
default public int getUnscaledHeight() {
return getHeight();
}
}
private final Buffer buffer;