rename functions to be moved to libyuv
Bug: webrtc:13826 Change-Id: I0d694cbe35a272fbe5da9dc6e74c88a976458df8 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/257441 Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org> Reviewed-by: Niels Moller <nisse@webrtc.org> Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Frank Barchard <fbarchard@google.com> Cr-Commit-Position: refs/heads/main@{#36468}
This commit is contained in:
parent
0bf7880dfb
commit
00112748e1
@ -32,21 +32,25 @@ int I422DataSize(int height, int stride_y, int stride_u, int stride_v) {
|
||||
return stride_y * height + stride_u * height + stride_v * height;
|
||||
}
|
||||
|
||||
int I422Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height,
|
||||
enum libyuv::RotationMode mode) {
|
||||
// TODO(sergio.garcia.murillo@gmail.com): Remove as soon it is available in
|
||||
// libyuv. Due to the rotate&scale required, this function may not be merged in
|
||||
// to libyuv inmediatelly.
|
||||
// https://bugs.chromium.org/p/libyuv/issues/detail?id=926
|
||||
int webrtcI422Rotate(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int width,
|
||||
int height,
|
||||
enum libyuv::RotationMode mode) {
|
||||
int halfwidth = (width + 1) >> 1;
|
||||
int halfheight = (height + 1) >> 1;
|
||||
if (!src_y || !src_u || !src_v || width <= 0 || height == 0 || !dst_y ||
|
||||
@ -115,23 +119,25 @@ int I422Rotate(const uint8_t* src_y,
|
||||
return -1;
|
||||
}
|
||||
|
||||
int I422Scale(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
enum libyuv::FilterMode filtering) {
|
||||
// TODO(sergio.garcia.murillo@gmail.com): Remove this function with libyuv one
|
||||
// as soon as the dependency is updated.
|
||||
int webrtcI422Scale(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_u,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
enum libyuv::FilterMode filtering) {
|
||||
if (!src_y || !src_u || !src_v || src_width <= 0 || src_height == 0 ||
|
||||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_u || !dst_v ||
|
||||
dst_width <= 0 || dst_height <= 0) {
|
||||
@ -250,13 +256,13 @@ rtc::scoped_refptr<I422Buffer> I422Buffer::Rotate(
|
||||
rtc::scoped_refptr<webrtc::I422Buffer> buffer =
|
||||
I422Buffer::Create(rotated_width, rotated_height);
|
||||
|
||||
RTC_CHECK_EQ(
|
||||
0,
|
||||
I422Rotate(src.DataY(), src.StrideY(), src.DataU(), src.StrideU(),
|
||||
src.DataV(), src.StrideV(), buffer->MutableDataY(),
|
||||
buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(),
|
||||
buffer->MutableDataV(), buffer->StrideV(), src.width(),
|
||||
src.height(), static_cast<libyuv::RotationMode>(rotation)));
|
||||
RTC_CHECK_EQ(0,
|
||||
webrtcI422Rotate(
|
||||
src.DataY(), src.StrideY(), src.DataU(), src.StrideU(),
|
||||
src.DataV(), src.StrideV(), buffer->MutableDataY(),
|
||||
buffer->StrideY(), buffer->MutableDataU(), buffer->StrideU(),
|
||||
buffer->MutableDataV(), buffer->StrideV(), src.width(),
|
||||
src.height(), static_cast<libyuv::RotationMode>(rotation)));
|
||||
|
||||
return buffer;
|
||||
}
|
||||
@ -337,7 +343,8 @@ void I422Buffer::CropAndScaleFrom(const I422BufferInterface& src,
|
||||
src.DataU() + src.StrideU() * uv_offset_y + uv_offset_x;
|
||||
const uint8_t* v_plane =
|
||||
src.DataV() + src.StrideV() * uv_offset_y + uv_offset_x;
|
||||
int res = I422Scale(y_plane, src.StrideY(), u_plane, src.StrideU(), v_plane,
|
||||
int res =
|
||||
webrtcI422Scale(y_plane, src.StrideY(), u_plane, src.StrideU(), v_plane,
|
||||
src.StrideV(), crop_width, crop_height, MutableDataY(),
|
||||
StrideY(), MutableDataU(), StrideU(), MutableDataV(),
|
||||
StrideV(), width(), height(), libyuv::kFilterBox);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user