mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
Fix ConvertToI420 when using YUY2 or UYVY with odd crop_x.
- swap U and V when crop x is odd - document YUY2 and UYVY formats - apply clang-format Bug: libyuv:902 Change-Id: I045e44c907f4a9eb625d7c024b669bb308055f32 Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/3039549 Reviewed-by: Mirko Bonadei <mbonadei@chromium.org>
This commit is contained in:
parent
0572e0a0b1
commit
639dd4ea76
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1788
|
||||
Version: 1789
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -189,7 +189,6 @@ In memory R is the lowest and A is the highest.
|
||||
Each channel has value ranges from 0 to 65535.
|
||||
AR64 is similar to ARGB.
|
||||
|
||||
|
||||
# NV12 and NV21
|
||||
|
||||
NV12 is a biplanar format with a full sized Y plane followed by a single
|
||||
@ -200,3 +199,10 @@ height chroma channel, and therefore is a 420 subsampling.
|
||||
NV16 is 16 bits per pixel, with half width and full height. aka 422.
|
||||
NV24 is 24 bits per pixel with full sized chroma channel. aka 444.
|
||||
Most NV12 functions allow the destination Y pointer to be NULL.
|
||||
|
||||
# YUY2 and UYVY
|
||||
|
||||
YUY2 is a packed YUV format with half width, full height.
|
||||
|
||||
YUY2 is YUYV in memory
|
||||
UYVY is UYVY in memory
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1788
|
||||
#define LIBYUV_VERSION 1789
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -89,18 +89,26 @@ int ConvertToI420(const uint8_t* sample,
|
||||
|
||||
switch (format) {
|
||||
// Single plane formats
|
||||
case FOURCC_YUY2:
|
||||
case FOURCC_YUY2: { // TODO(fbarchard): Find better odd crop fix.
|
||||
uint8_t* u = (crop_x & 1) ? dst_v : dst_u;
|
||||
uint8_t* v = (crop_x & 1) ? dst_u : dst_v;
|
||||
int stride_u = (crop_x & 1) ? dst_stride_v : dst_stride_u;
|
||||
int stride_v = (crop_x & 1) ? dst_stride_u : dst_stride_v;
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = YUY2ToI420(src, aligned_src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
r = YUY2ToI420(src, aligned_src_width * 2, dst_y, dst_stride_y, u,
|
||||
stride_u, v, stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
}
|
||||
case FOURCC_UYVY: {
|
||||
uint8_t* u = (crop_x & 1) ? dst_v : dst_u;
|
||||
uint8_t* v = (crop_x & 1) ? dst_u : dst_v;
|
||||
int stride_u = (crop_x & 1) ? dst_stride_v : dst_stride_u;
|
||||
int stride_v = (crop_x & 1) ? dst_stride_u : dst_stride_v;
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = UYVYToI420(src, aligned_src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
r = UYVYToI420(src, aligned_src_width * 2, dst_y, dst_stride_y, u,
|
||||
stride_u, v, stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
case FOURCC_RGBP:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = RGB565ToI420(src, src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user