mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2026-02-16 23:29:52 +08:00
P010ToI010 and P012ToI012 conversion functions
- Convert 10 and 12 bit biplanar formats to planar. - Shift 10 MSB to 10 LSB - P010 is similar to NV12 in layout, but uses 10 MSB of 16 bit values. - I010 is similar to I420 in layout, but uses 10 LSB of 16 bit values. Bug: libyuv:951 Change-Id: I16a1bc64239d0fa4f41810910da448bf5720935f Reviewed-on: https://chromium-review.googlesource.com/c/libyuv/libyuv/+/4166560 Reviewed-by: Justin Green <greenjustin@google.com> Commit-Queue: Frank Barchard <fbarchard@chromium.org>
This commit is contained in:
parent
010dea8ba4
commit
d5aa3d4a76
@ -1,6 +1,6 @@
|
|||||||
Name: libyuv
|
Name: libyuv
|
||||||
URL: http://code.google.com/p/libyuv/
|
URL: http://code.google.com/p/libyuv/
|
||||||
Version: 1856
|
Version: 1857
|
||||||
License: BSD
|
License: BSD
|
||||||
License File: LICENSE
|
License File: LICENSE
|
||||||
|
|
||||||
|
|||||||
@ -604,6 +604,36 @@ int NV16ToNV24(const uint8_t* src_y,
|
|||||||
int width,
|
int width,
|
||||||
int height);
|
int height);
|
||||||
|
|
||||||
|
// Convert P010 to I010.
|
||||||
|
LIBYUV_API
|
||||||
|
int P010ToI010(const uint16_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint16_t* src_uv,
|
||||||
|
int src_stride_uv,
|
||||||
|
uint16_t* dst_y,
|
||||||
|
int dst_stride_y,
|
||||||
|
uint16_t* dst_u,
|
||||||
|
int dst_stride_u,
|
||||||
|
uint16_t* dst_v,
|
||||||
|
int dst_stride_v,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
|
// Convert P012 to I012.
|
||||||
|
LIBYUV_API
|
||||||
|
int P012ToI012(const uint16_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint16_t* src_uv,
|
||||||
|
int src_stride_uv,
|
||||||
|
uint16_t* dst_y,
|
||||||
|
int dst_stride_y,
|
||||||
|
uint16_t* dst_u,
|
||||||
|
int dst_stride_u,
|
||||||
|
uint16_t* dst_v,
|
||||||
|
int dst_stride_v,
|
||||||
|
int width,
|
||||||
|
int height);
|
||||||
|
|
||||||
// Convert P010 to P410.
|
// Convert P010 to P410.
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int P010ToP410(const uint16_t* src_y,
|
int P010ToP410(const uint16_t* src_y,
|
||||||
|
|||||||
@ -11,6 +11,6 @@
|
|||||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||||
#define INCLUDE_LIBYUV_VERSION_H_
|
#define INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|
||||||
#define LIBYUV_VERSION 1856
|
#define LIBYUV_VERSION 1857
|
||||||
|
|
||||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||||
|
|||||||
@ -24,6 +24,7 @@ namespace libyuv {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// subsample amount uses a shift.
|
||||||
#define SUBSAMPLE(v, a, s) (v < 0) ? (-((-v + a) >> s)) : ((v + a) >> s)
|
#define SUBSAMPLE(v, a, s) (v < 0) ? (-((-v + a) >> s)) : ((v + a) >> s)
|
||||||
static __inline int Abs(int v) {
|
static __inline int Abs(int v) {
|
||||||
return v >= 0 ? v : -v;
|
return v >= 0 ? v : -v;
|
||||||
@ -1269,6 +1270,71 @@ int NV16ToNV24(const uint8_t* src_y,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Any P[420]1[02] to I[420]1[02] format with mirroring.
|
||||||
|
static int PxxxToIxxx(const uint16_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint16_t* src_uv,
|
||||||
|
int src_stride_uv,
|
||||||
|
uint16_t* dst_y,
|
||||||
|
int dst_stride_y,
|
||||||
|
uint16_t* dst_u,
|
||||||
|
int dst_stride_u,
|
||||||
|
uint16_t* dst_v,
|
||||||
|
int dst_stride_v,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
int subsample_x,
|
||||||
|
int subsample_y,
|
||||||
|
int depth) {
|
||||||
|
const int uv_width = SUBSAMPLE(width, subsample_x, subsample_x);
|
||||||
|
const int uv_height = SUBSAMPLE(height, subsample_y, subsample_y);
|
||||||
|
if (width <= 0 || height == 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConvertToLSBPlane_16(src_y, src_stride_y, dst_y, dst_stride_y, width, height,
|
||||||
|
depth);
|
||||||
|
SplitUVPlane_16(src_uv, src_stride_uv, dst_u, dst_stride_u, dst_v,
|
||||||
|
dst_stride_v, uv_width, uv_height, depth);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBYUV_API
|
||||||
|
int P010ToI010(const uint16_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint16_t* src_uv,
|
||||||
|
int src_stride_uv,
|
||||||
|
uint16_t* dst_y,
|
||||||
|
int dst_stride_y,
|
||||||
|
uint16_t* dst_u,
|
||||||
|
int dst_stride_u,
|
||||||
|
uint16_t* dst_v,
|
||||||
|
int dst_stride_v,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
return PxxxToIxxx(src_y, src_stride_y, src_uv, src_stride_uv, dst_y,
|
||||||
|
dst_stride_y, dst_u, dst_stride_u, dst_v, dst_stride_v,
|
||||||
|
width, height, 1, 1, 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
LIBYUV_API
|
||||||
|
int P012ToI012(const uint16_t* src_y,
|
||||||
|
int src_stride_y,
|
||||||
|
const uint16_t* src_uv,
|
||||||
|
int src_stride_uv,
|
||||||
|
uint16_t* dst_y,
|
||||||
|
int dst_stride_y,
|
||||||
|
uint16_t* dst_u,
|
||||||
|
int dst_stride_u,
|
||||||
|
uint16_t* dst_v,
|
||||||
|
int dst_stride_v,
|
||||||
|
int width,
|
||||||
|
int height) {
|
||||||
|
return PxxxToIxxx(src_y, src_stride_y, src_uv, src_stride_uv, dst_y,
|
||||||
|
dst_stride_y, dst_u, dst_stride_u, dst_v, dst_stride_v,
|
||||||
|
width, height, 1, 1, 12);
|
||||||
|
}
|
||||||
|
|
||||||
LIBYUV_API
|
LIBYUV_API
|
||||||
int P010ToP410(const uint16_t* src_y,
|
int P010ToP410(const uint16_t* src_y,
|
||||||
int src_stride_y,
|
int src_stride_y,
|
||||||
|
|||||||
@ -48,6 +48,7 @@ namespace libyuv {
|
|||||||
#define AR30ToAR30 ARGBCopy
|
#define AR30ToAR30 ARGBCopy
|
||||||
#define ABGRToABGR ARGBCopy
|
#define ABGRToABGR ARGBCopy
|
||||||
|
|
||||||
|
// subsample amount uses a divide.
|
||||||
#define SUBSAMPLE(v, a) ((((v) + (a)-1)) / (a))
|
#define SUBSAMPLE(v, a) ((((v) + (a)-1)) / (a))
|
||||||
|
|
||||||
// Planar test
|
// Planar test
|
||||||
@ -649,6 +650,8 @@ TESTBPTOBP(MT2T, uint8_t, 10 / 8, 2, 2, P010, uint16_t, 2, 2, 2, 10, 16, 32)
|
|||||||
TESTBPTOP(NV12, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 1, 1)
|
TESTBPTOP(NV12, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 1, 1)
|
||||||
TESTBPTOP(NV21, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 1, 1)
|
TESTBPTOP(NV21, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 1, 1)
|
||||||
TESTBPTOP(MM21, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 16, 32)
|
TESTBPTOP(MM21, uint8_t, 1, 2, 2, I420, uint8_t, 1, 2, 2, 8, 16, 32)
|
||||||
|
TESTBPTOP(P010, uint16_t, 2, 2, 2, I010, uint16_t, 2, 2, 2, 10, 1, 1)
|
||||||
|
TESTBPTOP(P012, uint16_t, 2, 2, 2, I012, uint16_t, 2, 2, 2, 12, 1, 1)
|
||||||
|
|
||||||
// Provide matrix wrappers for full range bt.709
|
// Provide matrix wrappers for full range bt.709
|
||||||
#define F420ToABGR(a, b, c, d, e, f, g, h, i, j) \
|
#define F420ToABGR(a, b, c, d, e, f, g, h, i, j) \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user