Add NV24 scaling support to libyuv

Some projects require scaling support for the NV24 format, but libyuv currently lacks this functionality. This commit adds a scaling function for NV24, enabling its use in projects that require NV24 format processing.

Change-Id: I6e6b2bea342e1df7f387056ab3bc5003da983bb7
Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/6068715
Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
Reviewed-by: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
runzezhang 2024-12-04 19:46:06 +08:00 committed by Frank Barchard
parent 85331e00cc
commit 192b8c2238
2 changed files with 47 additions and 0 deletions

View File

@ -287,6 +287,21 @@ int NV12Scale(const uint8_t* src_y,
int dst_height,
enum FilterMode filtering);
LIBYUV_API
int NV24Scale(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_uv,
int src_stride_uv,
int src_width,
int src_height,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_uv,
int dst_stride_uv,
int dst_width,
int dst_height,
enum FilterMode filtering);
#ifdef __cplusplus
// Legacy API. Deprecated.
LIBYUV_API

View File

@ -2724,6 +2724,38 @@ int NV12Scale(const uint8_t* src_y,
return r;
}
LIBYUV_API
int NV24Scale(const uint8_t* src_y,
int src_stride_y,
const uint8_t* src_uv,
int src_stride_uv,
int src_width,
int src_height,
uint8_t* dst_y,
int dst_stride_y,
uint8_t* dst_uv,
int dst_stride_uv,
int dst_width,
int dst_height,
enum FilterMode filtering) {
int r;
if (!src_y || !src_uv || src_width <= 0 || src_height == 0 ||
src_width > 32768 || src_height > 32768 || !dst_y || !dst_uv ||
dst_width <= 0 || dst_height <= 0) {
return -1;
}
r = ScalePlane(src_y, src_stride_y, src_width, src_height, dst_y,
dst_stride_y, dst_width, dst_height, filtering);
if (r != 0) {
return r;
}
r = UVScale(src_uv, src_stride_uv, src_width, src_height, dst_uv,
dst_stride_uv, dst_width, dst_height, filtering);
return r;
}
// Deprecated api
LIBYUV_API
int Scale(const uint8_t* src_y,