Expose ABGRToI420 in YuvHelper.
Bug: None Change-Id: I59947339a3a4bb683211ec3c00713ccfbf35bc40 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/160182 Reviewed-by: Paulina Hensman <phensman@webrtc.org> Commit-Queue: Sami Kalliomäki <sakal@webrtc.org> Cr-Commit-Position: refs/heads/master@{#29855}
This commit is contained in:
committed by
Commit Bot
parent
e835fc01b1
commit
b86a1770ee
@ -102,6 +102,13 @@ public class YuvHelper {
|
||||
nativeCopyPlane(src, srcStride, dst, dstStride, width, height);
|
||||
}
|
||||
|
||||
/** Converts ABGR little endian (rgba in memory) to I420. */
|
||||
public static void ABGRToI420(ByteBuffer src, int srcStride, ByteBuffer dstY, int dstStrideY,
|
||||
ByteBuffer dstU, int dstStrideU, ByteBuffer dstV, int dstStrideV, int width, int height) {
|
||||
nativeABGRToI420(
|
||||
src, srcStride, dstY, dstStrideY, dstU, dstStrideU, dstV, dstStrideV, width, height);
|
||||
}
|
||||
|
||||
public static void I420Copy(ByteBuffer srcY, int srcStrideY, ByteBuffer srcU, int srcStrideU,
|
||||
ByteBuffer srcV, int srcStrideV, ByteBuffer dstY, int dstStrideY, ByteBuffer dstU,
|
||||
int dstStrideU, ByteBuffer dstV, int dstStrideV, int width, int height) {
|
||||
@ -136,4 +143,7 @@ public class YuvHelper {
|
||||
int srcStrideU, ByteBuffer srcV, int srcStrideV, ByteBuffer dstY, int dstStrideY,
|
||||
ByteBuffer dstU, int dstStrideU, ByteBuffer dstV, int dstStrideV, int srcWidth, int srcHeight,
|
||||
int rotationMode);
|
||||
private static native void nativeABGRToI420(ByteBuffer src, int srcStride, ByteBuffer dstY,
|
||||
int dstStrideY, ByteBuffer dstU, int dstStrideU, ByteBuffer dstV, int dstStrideV, int width,
|
||||
int height);
|
||||
}
|
||||
|
||||
@ -130,5 +130,29 @@ void JNI_YuvHelper_I420Rotate(JNIEnv* jni,
|
||||
static_cast<libyuv::RotationMode>(rotation_mode));
|
||||
}
|
||||
|
||||
void JNI_YuvHelper_ABGRToI420(JNIEnv* jni,
|
||||
const JavaParamRef<jobject>& j_src,
|
||||
jint src_stride,
|
||||
const JavaParamRef<jobject>& j_dst_y,
|
||||
jint dst_stride_y,
|
||||
const JavaParamRef<jobject>& j_dst_u,
|
||||
jint dst_stride_u,
|
||||
const JavaParamRef<jobject>& j_dst_v,
|
||||
jint dst_stride_v,
|
||||
jint src_width,
|
||||
jint src_height) {
|
||||
const uint8_t* src =
|
||||
static_cast<const uint8_t*>(jni->GetDirectBufferAddress(j_src.obj()));
|
||||
uint8_t* dst_y =
|
||||
static_cast<uint8_t*>(jni->GetDirectBufferAddress(j_dst_y.obj()));
|
||||
uint8_t* dst_u =
|
||||
static_cast<uint8_t*>(jni->GetDirectBufferAddress(j_dst_u.obj()));
|
||||
uint8_t* dst_v =
|
||||
static_cast<uint8_t*>(jni->GetDirectBufferAddress(j_dst_v.obj()));
|
||||
|
||||
libyuv::ABGRToI420(src, src_stride, dst_y, dst_stride_y, dst_u, dst_stride_u,
|
||||
dst_v, dst_stride_v, src_width, src_height);
|
||||
}
|
||||
|
||||
} // namespace jni
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user