mirror of
https://chromium.googlesource.com/libyuv/libyuv
synced 2025-12-06 16:56:55 +08:00
tidy applied with readability-inconsistent-declaration-parameter-name
Bug: libyuv:750 Test: builds and runs and passes more tidy tests Change-Id: I023699a7aa61ea3f5e4a21647112691ea5739281 Reviewed-on: https://chromium-review.googlesource.com/902170 Reviewed-by: Weiyong Yao <braveyao@chromium.org>
This commit is contained in:
parent
b625f7b932
commit
e1f6c1c0b5
@ -1,6 +1,6 @@
|
||||
Name: libyuv
|
||||
URL: http://code.google.com/p/libyuv/
|
||||
Version: 1696
|
||||
Version: 1697
|
||||
License: BSD
|
||||
License File: LICENSE
|
||||
|
||||
|
||||
@ -28,7 +28,7 @@ typedef unsigned char uint8_t;
|
||||
typedef signed char int8_t;
|
||||
#else
|
||||
#include <stdint.h> // for uintptr_t and C99 types
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
#endif // defined(_MSC_VER) && (_MSC_VER < 1600)
|
||||
typedef uint64_t uint64;
|
||||
typedef int64_t int64;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@ -206,7 +206,7 @@ int Android420ToI420(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
int pixel_stride_uv,
|
||||
int src_pixel_stride_uv,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -218,8 +218,8 @@ int Android420ToI420(const uint8_t* src_y,
|
||||
|
||||
// ARGB little endian (bgra in memory) to I420.
|
||||
LIBYUV_API
|
||||
int ARGBToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ARGBToI420(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -231,8 +231,8 @@ int ARGBToI420(const uint8_t* src_frame,
|
||||
|
||||
// BGRA little endian (argb in memory) to I420.
|
||||
LIBYUV_API
|
||||
int BGRAToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int BGRAToI420(const uint8_t* src_bgra,
|
||||
int src_stride_bgra,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -244,8 +244,8 @@ int BGRAToI420(const uint8_t* src_frame,
|
||||
|
||||
// ABGR little endian (rgba in memory) to I420.
|
||||
LIBYUV_API
|
||||
int ABGRToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ABGRToI420(const uint8_t* src_abgr,
|
||||
int src_stride_abgr,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -257,8 +257,8 @@ int ABGRToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGBA little endian (abgr in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RGBAToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGBAToI420(const uint8_t* src_rgba,
|
||||
int src_stride_rgba,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -270,8 +270,8 @@ int RGBAToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGB little endian (bgr in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RGB24ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGB24ToI420(const uint8_t* src_rgb24,
|
||||
int src_stride_rgb24,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -283,8 +283,8 @@ int RGB24ToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGB big endian (rgb in memory) to I420.
|
||||
LIBYUV_API
|
||||
int RAWToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RAWToI420(const uint8_t* src_raw,
|
||||
int src_stride_raw,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -296,8 +296,8 @@ int RAWToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGB16 (RGBP fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int RGB565ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGB565ToI420(const uint8_t* src_rgb565,
|
||||
int src_stride_rgb565,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -309,8 +309,8 @@ int RGB565ToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGB15 (RGBO fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ARGB1555ToI420(const uint8_t* src_argb1555,
|
||||
int src_stride_argb1555,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -322,8 +322,8 @@ int ARGB1555ToI420(const uint8_t* src_frame,
|
||||
|
||||
// RGB12 (R444 fourcc) little endian to I420.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToI420(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ARGB4444ToI420(const uint8_t* src_argb4444,
|
||||
int src_stride_argb4444,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -378,11 +378,11 @@ int MJPGSize(const uint8_t* sample,
|
||||
// Must be less than or equal to src_width/src_height
|
||||
// Cropping parameters are pre-rotation.
|
||||
// "rotation" can be 0, 90, 180 or 270.
|
||||
// "format" is a fourcc. ie 'I420', 'YUY2'
|
||||
// "fourcc" is a fourcc. ie 'I420', 'YUY2'
|
||||
// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
|
||||
LIBYUV_API
|
||||
int ConvertToI420(const uint8_t* src_frame,
|
||||
size_t src_size,
|
||||
int ConvertToI420(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_u,
|
||||
@ -396,7 +396,7 @@ int ConvertToI420(const uint8_t* src_frame,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32_t format);
|
||||
uint32_t fourcc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -269,8 +269,8 @@ int NV12ToABGR(const uint8_t* src_y,
|
||||
LIBYUV_API
|
||||
int NV21ToABGR(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
@ -448,8 +448,8 @@ int H010ToAR30(const uint16_t* src_y,
|
||||
|
||||
// BGRA little endian (argb in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int BGRAToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int BGRAToARGB(const uint8_t* src_bgra,
|
||||
int src_stride_bgra,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -457,8 +457,8 @@ int BGRAToARGB(const uint8_t* src_frame,
|
||||
|
||||
// ABGR little endian (rgba in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int ABGRToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ABGRToARGB(const uint8_t* src_abgr,
|
||||
int src_stride_abgr,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -466,8 +466,8 @@ int ABGRToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGBA little endian (abgr in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RGBAToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGBAToARGB(const uint8_t* src_rgba,
|
||||
int src_stride_rgba,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -478,8 +478,8 @@ int RGBAToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGB little endian (bgr in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RGB24ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGB24ToARGB(const uint8_t* src_rgb24,
|
||||
int src_stride_rgb24,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -487,8 +487,8 @@ int RGB24ToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGB big endian (rgb in memory) to ARGB.
|
||||
LIBYUV_API
|
||||
int RAWToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RAWToARGB(const uint8_t* src_raw,
|
||||
int src_stride_raw,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -496,8 +496,8 @@ int RAWToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGB16 (RGBP fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int RGB565ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int RGB565ToARGB(const uint8_t* src_rgb565,
|
||||
int src_stride_rgb565,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -505,8 +505,8 @@ int RGB565ToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGB15 (RGBO fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGB1555ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ARGB1555ToARGB(const uint8_t* src_argb1555,
|
||||
int src_stride_argb1555,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -514,8 +514,8 @@ int ARGB1555ToARGB(const uint8_t* src_frame,
|
||||
|
||||
// RGB12 (R444 fourcc) little endian to ARGB.
|
||||
LIBYUV_API
|
||||
int ARGB4444ToARGB(const uint8_t* src_frame,
|
||||
int src_stride_frame,
|
||||
int ARGB4444ToARGB(const uint8_t* src_argb4444,
|
||||
int src_stride_argb4444,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
@ -582,7 +582,7 @@ int Android420ToABGR(const uint8_t* src_y,
|
||||
int height);
|
||||
|
||||
// Convert camera sample to ARGB with cropping, rotation and vertical flip.
|
||||
// "src_size" is needed to parse MJPG.
|
||||
// "sample_size" is needed to parse MJPG.
|
||||
// "dst_stride_argb" number of bytes in a row of the dst_argb plane.
|
||||
// Normally this would be the same as dst_width, with recommended alignment
|
||||
// to 16 bytes for better efficiency.
|
||||
@ -601,11 +601,11 @@ int Android420ToABGR(const uint8_t* src_y,
|
||||
// Must be less than or equal to src_width/src_height
|
||||
// Cropping parameters are pre-rotation.
|
||||
// "rotation" can be 0, 90, 180 or 270.
|
||||
// "format" is a fourcc. ie 'I420', 'YUY2'
|
||||
// "fourcc" is a fourcc. ie 'I420', 'YUY2'
|
||||
// Returns 0 for successful; -1 for invalid parameter. Non-zero for failure.
|
||||
LIBYUV_API
|
||||
int ConvertToARGB(const uint8_t* src_frame,
|
||||
size_t src_size,
|
||||
int ConvertToARGB(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int crop_x,
|
||||
@ -615,7 +615,7 @@ int ConvertToARGB(const uint8_t* src_frame,
|
||||
int crop_width,
|
||||
int crop_height,
|
||||
enum RotationMode rotation,
|
||||
uint32_t format);
|
||||
uint32_t fourcc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -114,8 +114,8 @@ int I420ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -126,8 +126,8 @@ int I420ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -150,8 +150,8 @@ int I420ToBGRA(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
uint8_t* dst_bgra,
|
||||
int dst_stride_bgra,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -162,8 +162,8 @@ int I420ToABGR(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
uint8_t* dst_abgr,
|
||||
int dst_stride_abgr,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -186,8 +186,8 @@ int I420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -198,8 +198,8 @@ int I420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -210,8 +210,8 @@ int H420ToRGB24(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_rgb24,
|
||||
int dst_stride_rgb24,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -222,8 +222,8 @@ int H420ToRAW(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -234,8 +234,8 @@ int I420ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -246,8 +246,8 @@ int I422ToRGB565(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -262,8 +262,8 @@ int I420ToRGB565Dither(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_rgb565,
|
||||
int dst_stride_rgb565,
|
||||
const uint8_t* dither4x4,
|
||||
int width,
|
||||
int height);
|
||||
@ -275,8 +275,8 @@ int I420ToARGB1555(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_argb1555,
|
||||
int dst_stride_argb1555,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -287,8 +287,8 @@ int I420ToARGB4444(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_argb4444,
|
||||
int dst_stride_argb4444,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -332,7 +332,7 @@ int ConvertFromI420(const uint8_t* y,
|
||||
int dst_sample_stride,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t format);
|
||||
uint32_t fourcc);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -86,8 +86,8 @@ int ARGBToRGB24(const uint8_t* src_argb,
|
||||
LIBYUV_API
|
||||
int ARGBToRAW(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8_t* dst_rgb,
|
||||
int dst_stride_rgb,
|
||||
uint8_t* dst_raw,
|
||||
int dst_stride_raw,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
||||
@ -84,7 +84,7 @@ int MaskCpuFlags(int enable_flags);
|
||||
// eax is the info type that you want.
|
||||
// ecx is typically the cpu number, and should normally be zero.
|
||||
LIBYUV_API
|
||||
void CpuId(int eax, int ecx, int* cpu_info);
|
||||
void CpuId(int info_eax, int info_ecx, int* cpu_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@ -373,8 +373,8 @@ int I420Rect(uint8_t* dst_y,
|
||||
LIBYUV_API
|
||||
int ARGBRect(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height,
|
||||
uint32_t value);
|
||||
@ -392,8 +392,8 @@ int ARGBGrayTo(const uint8_t* src_argb,
|
||||
LIBYUV_API
|
||||
int ARGBGray(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -401,8 +401,8 @@ int ARGBGray(uint8_t* dst_argb,
|
||||
LIBYUV_API
|
||||
int ARGBSepia(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -431,8 +431,8 @@ LIBYUV_API
|
||||
int RGBColorMatrix(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const int8_t* matrix_rgb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -442,8 +442,8 @@ LIBYUV_API
|
||||
int ARGBColorTable(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8_t* table_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -453,8 +453,8 @@ LIBYUV_API
|
||||
int RGBColorTable(uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8_t* table_argb,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -466,7 +466,7 @@ int ARGBLumaColorTable(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const uint8_t* luma_rgb_table,
|
||||
const uint8_t* luma,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -508,8 +508,8 @@ int ARGBQuantize(uint8_t* dst_argb,
|
||||
int scale,
|
||||
int interval_size,
|
||||
int interval_offset,
|
||||
int x,
|
||||
int y,
|
||||
int dst_x,
|
||||
int dst_y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -653,8 +653,8 @@ int I422ToYUY2(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_yuy2,
|
||||
int dst_stride_yuy2,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
@ -666,8 +666,8 @@ int I422ToUYVY(const uint8_t* src_y,
|
||||
int src_stride_u,
|
||||
const uint8_t* src_v,
|
||||
int src_stride_v,
|
||||
uint8_t* dst_frame,
|
||||
int dst_stride_frame,
|
||||
uint8_t* dst_uyvy,
|
||||
int dst_stride_uyvy,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
|
||||
@ -45,8 +45,8 @@ int I420Rotate(const uint8_t* src_y,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int width,
|
||||
int height,
|
||||
enum RotationMode mode);
|
||||
|
||||
// Rotate NV12 input and store in I420.
|
||||
@ -61,8 +61,8 @@ int NV12ToI420Rotate(const uint8_t* src_y,
|
||||
int dst_stride_u,
|
||||
uint8_t* dst_v,
|
||||
int dst_stride_v,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int width,
|
||||
int height,
|
||||
enum RotationMode mode);
|
||||
|
||||
// Rotate a plane by 0, 90, 180, or 270.
|
||||
@ -71,8 +71,8 @@ int RotatePlane(const uint8_t* src,
|
||||
int src_stride,
|
||||
uint8_t* dst,
|
||||
int dst_stride,
|
||||
int src_width,
|
||||
int src_height,
|
||||
int width,
|
||||
int height,
|
||||
enum RotationMode mode);
|
||||
|
||||
// Rotate planes by 90, 180, 270. Deprecated.
|
||||
|
||||
1696
include/libyuv/row.h
1696
include/libyuv/row.h
File diff suppressed because it is too large
Load Diff
@ -118,17 +118,6 @@ int Scale(const uint8_t* src_y,
|
||||
int dst_height,
|
||||
LIBYUV_BOOL interpolate);
|
||||
|
||||
// Legacy API. Deprecated.
|
||||
LIBYUV_API
|
||||
int ScaleOffset(const uint8_t* src_i420,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8_t* dst_i420,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int dst_yoffset,
|
||||
LIBYUV_BOOL interpolate);
|
||||
|
||||
// For testing, allow disabling of specialized scalers.
|
||||
LIBYUV_API
|
||||
void SetUseReferenceImpl(LIBYUV_BOOL use);
|
||||
|
||||
@ -270,12 +270,12 @@ void ScaleFilterCols_16_C(uint16_t* dst_ptr,
|
||||
void ScaleFilterCols64_C(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int x32,
|
||||
int dx);
|
||||
void ScaleFilterCols64_16_C(uint16_t* dst_ptr,
|
||||
const uint16_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int x32,
|
||||
int dx);
|
||||
void ScaleRowDown38_C(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
@ -335,7 +335,7 @@ void ScaleARGBCols_C(uint8_t* dst_argb,
|
||||
void ScaleARGBCols64_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int x32,
|
||||
int dx);
|
||||
void ScaleARGBColsUp2_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
@ -350,7 +350,7 @@ void ScaleARGBFilterCols_C(uint8_t* dst_argb,
|
||||
void ScaleARGBFilterCols64_C(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int x32,
|
||||
int dx);
|
||||
|
||||
// Specialized scalers for x86.
|
||||
@ -539,13 +539,13 @@ void ScaleARGBCols_NEON(uint8_t* dst_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
void ScaleARGBFilterCols_Any_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
void ScaleARGBFilterCols_Any_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
void ScaleARGBCols_Any_NEON(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
void ScaleARGBCols_Any_NEON(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
@ -559,13 +559,13 @@ void ScaleARGBCols_MSA(uint8_t* dst_argb,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
void ScaleARGBFilterCols_Any_MSA(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
void ScaleARGBFilterCols_Any_MSA(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
void ScaleARGBCols_Any_MSA(uint8_t* dst_argb,
|
||||
const uint8_t* src_argb,
|
||||
void ScaleARGBCols_Any_MSA(uint8_t* dst_ptr,
|
||||
const uint8_t* src_ptr,
|
||||
int dst_width,
|
||||
int x,
|
||||
int dx);
|
||||
@ -607,41 +607,41 @@ void ScaleARGBRowDown2Box_MSA(const uint8_t* src_argb,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2_Any_SSE2(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2_Any_SSE2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Linear_Any_SSE2(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2Linear_Any_SSE2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Box_Any_SSE2(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2Box_Any_SSE2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Linear_Any_NEON(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2Linear_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Box_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2_Any_MSA(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Linear_Any_MSA(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2Linear_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDown2Box_Any_MSA(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDown2Box_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
|
||||
void ScaleARGBRowDownEven_SSE2(const uint8_t* src_argb,
|
||||
@ -674,35 +674,35 @@ void ScaleARGBRowDownEvenBox_MSA(const uint8_t* src_argb,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEven_Any_SSE2(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEven_Any_SSE2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_Any_SSE2(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEven_Any_NEON(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEven_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEvenBox_Any_NEON(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEven_Any_MSA(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEven_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int32_t src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleARGBRowDownEvenBox_Any_MSA(const uint8_t* src_argb,
|
||||
void ScaleARGBRowDownEvenBox_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
int src_stepx,
|
||||
uint8_t* dst_argb,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
|
||||
// ScaleRowDown2Box also used by planar functions
|
||||
@ -765,19 +765,19 @@ void ScaleRowDown38_2_Box_NEON(const uint8_t* src_ptr,
|
||||
|
||||
void ScaleRowDown2_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown2Linear_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown2Box_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown2Box_Odd_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown4_Any_NEON(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
@ -872,40 +872,40 @@ void ScaleFilterCols_MSA(uint8_t* dst_ptr,
|
||||
int dx);
|
||||
void ScaleRowDown34_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr,
|
||||
uint8_t* dst,
|
||||
int dst_width);
|
||||
void ScaleRowDown34_0_Box_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr,
|
||||
uint8_t* d,
|
||||
int dst_width);
|
||||
void ScaleRowDown34_1_Box_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst_ptr,
|
||||
uint8_t* d,
|
||||
int dst_width);
|
||||
|
||||
void ScaleRowDown2_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown2Linear_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown2Box_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown4_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown4Box_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown38_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
uint8_t* dst,
|
||||
uint8_t* dst_ptr,
|
||||
int dst_width);
|
||||
void ScaleRowDown38_2_Box_Any_MSA(const uint8_t* src_ptr,
|
||||
ptrdiff_t src_stride,
|
||||
|
||||
@ -11,6 +11,6 @@
|
||||
#ifndef INCLUDE_LIBYUV_VERSION_H_
|
||||
#define INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
#define LIBYUV_VERSION 1696
|
||||
#define LIBYUV_VERSION 1697
|
||||
|
||||
#endif // INCLUDE_LIBYUV_VERSION_H_
|
||||
|
||||
@ -1570,8 +1570,8 @@ static int NV12ToARGBMatrix(const uint8_t* src_y,
|
||||
// Convert NV21 to ARGB with matrix
|
||||
static int NV21ToARGBMatrix(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
@ -1581,7 +1581,7 @@ static int NV21ToARGBMatrix(const uint8_t* src_y,
|
||||
void (*NV21ToARGBRow)(
|
||||
const uint8_t* y_buf, const uint8_t* uv_buf, uint8_t* rgb_buf,
|
||||
const struct YuvConstants* yuvconstants, int width) = NV21ToARGBRow_C;
|
||||
if (!src_y || !src_uv || !dst_argb || width <= 0 || height == 0) {
|
||||
if (!src_y || !src_vu || !dst_argb || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
// Negative height means invert the image.
|
||||
@ -1624,11 +1624,11 @@ static int NV21ToARGBMatrix(const uint8_t* src_y,
|
||||
#endif
|
||||
|
||||
for (y = 0; y < height; ++y) {
|
||||
NV21ToARGBRow(src_y, src_uv, dst_argb, yuvconstants, width);
|
||||
NV21ToARGBRow(src_y, src_vu, dst_argb, yuvconstants, width);
|
||||
dst_argb += dst_stride_argb;
|
||||
src_y += src_stride_y;
|
||||
if (y & 1) {
|
||||
src_uv += src_stride_uv;
|
||||
src_vu += src_stride_vu;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
@ -1652,13 +1652,13 @@ int NV12ToARGB(const uint8_t* src_y,
|
||||
LIBYUV_API
|
||||
int NV21ToARGB(const uint8_t* src_y,
|
||||
int src_stride_y,
|
||||
const uint8_t* src_uv,
|
||||
int src_stride_uv,
|
||||
const uint8_t* src_vu,
|
||||
int src_stride_vu,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int width,
|
||||
int height) {
|
||||
return NV21ToARGBMatrix(src_y, src_stride_y, src_uv, src_stride_uv, dst_argb,
|
||||
return NV21ToARGBMatrix(src_y, src_stride_y, src_vu, src_stride_vu, dst_argb,
|
||||
dst_stride_argb, &kYuvI601Constants, width, height);
|
||||
}
|
||||
|
||||
|
||||
@ -360,8 +360,8 @@ int ARGBToNV21(const uint8_t* src_argb,
|
||||
int src_stride_argb,
|
||||
uint8_t* dst_y,
|
||||
int dst_stride_y,
|
||||
uint8_t* dst_uv,
|
||||
int dst_stride_uv,
|
||||
uint8_t* dst_vu,
|
||||
int dst_stride_vu,
|
||||
int width,
|
||||
int height) {
|
||||
int y;
|
||||
@ -372,8 +372,8 @@ int ARGBToNV21(const uint8_t* src_argb,
|
||||
void (*ARGBToYRow)(const uint8_t* src_argb, uint8_t* dst_y, int width) =
|
||||
ARGBToYRow_C;
|
||||
void (*MergeUVRow_)(const uint8_t* src_u, const uint8_t* src_v,
|
||||
uint8_t* dst_uv, int width) = MergeUVRow_C;
|
||||
if (!src_argb || !dst_y || !dst_uv || width <= 0 || height == 0) {
|
||||
uint8_t* dst_vu, int width) = MergeUVRow_C;
|
||||
if (!src_argb || !dst_y || !dst_vu || width <= 0 || height == 0) {
|
||||
return -1;
|
||||
}
|
||||
// Negative height means invert the image.
|
||||
@ -473,16 +473,16 @@ int ARGBToNV21(const uint8_t* src_argb,
|
||||
|
||||
for (y = 0; y < height - 1; y += 2) {
|
||||
ARGBToUVRow(src_argb, src_stride_argb, row_u, row_v, width);
|
||||
MergeUVRow_(row_v, row_u, dst_uv, halfwidth);
|
||||
MergeUVRow_(row_v, row_u, dst_vu, halfwidth);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
ARGBToYRow(src_argb + src_stride_argb, dst_y + dst_stride_y, width);
|
||||
src_argb += src_stride_argb * 2;
|
||||
dst_y += dst_stride_y * 2;
|
||||
dst_uv += dst_stride_uv;
|
||||
dst_vu += dst_stride_vu;
|
||||
}
|
||||
if (height & 1) {
|
||||
ARGBToUVRow(src_argb, 0, row_u, row_v, width);
|
||||
MergeUVRow_(row_v, row_u, dst_uv, halfwidth);
|
||||
MergeUVRow_(row_v, row_u, dst_vu, halfwidth);
|
||||
ARGBToYRow(src_argb, dst_y, width);
|
||||
}
|
||||
free_aligned_buffer_64(row_u);
|
||||
|
||||
@ -31,8 +31,8 @@ extern "C" {
|
||||
LIBYUV_API
|
||||
int ConvertToARGB(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8_t* crop_argb,
|
||||
int argb_stride,
|
||||
uint8_t* dst_argb,
|
||||
int dst_stride_argb,
|
||||
int crop_x,
|
||||
int crop_y,
|
||||
int src_width,
|
||||
@ -52,17 +52,17 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
// One pass rotation is available for some formats. For the rest, convert
|
||||
// to ARGB (with optional vertical flipping) into a temporary ARGB buffer,
|
||||
// and then rotate the ARGB to the final destination buffer.
|
||||
// For in-place conversion, if destination crop_argb is same as source sample,
|
||||
// For in-place conversion, if destination dst_argb is same as source sample,
|
||||
// also enable temporary buffer.
|
||||
LIBYUV_BOOL need_buf =
|
||||
(rotation && format != FOURCC_ARGB) || crop_argb == sample;
|
||||
uint8_t* dest_argb = crop_argb;
|
||||
int dest_argb_stride = argb_stride;
|
||||
(rotation && format != FOURCC_ARGB) || dst_argb == sample;
|
||||
uint8_t* dest_argb = dst_argb;
|
||||
int dest_dst_stride_argb = dst_stride_argb;
|
||||
uint8_t* rotate_buffer = NULL;
|
||||
int abs_crop_height = (crop_height < 0) ? -crop_height : crop_height;
|
||||
|
||||
if (crop_argb == NULL || sample == NULL || src_width <= 0 ||
|
||||
crop_width <= 0 || src_height == 0 || crop_height == 0) {
|
||||
if (dst_argb == NULL || sample == NULL || src_width <= 0 || crop_width <= 0 ||
|
||||
src_height == 0 || crop_height == 0) {
|
||||
return -1;
|
||||
}
|
||||
if (src_height < 0) {
|
||||
@ -75,72 +75,72 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
if (!rotate_buffer) {
|
||||
return 1; // Out of memory runtime error.
|
||||
}
|
||||
crop_argb = rotate_buffer;
|
||||
argb_stride = crop_width * 4;
|
||||
dst_argb = rotate_buffer;
|
||||
dst_stride_argb = crop_width * 4;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
// Single plane formats
|
||||
case FOURCC_YUY2:
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = YUY2ToARGB(src, aligned_src_width * 2, crop_argb, argb_stride,
|
||||
r = YUY2ToARGB(src, aligned_src_width * 2, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = UYVYToARGB(src, aligned_src_width * 2, crop_argb, argb_stride,
|
||||
r = UYVYToARGB(src, aligned_src_width * 2, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_24BG:
|
||||
src = sample + (src_width * crop_y + crop_x) * 3;
|
||||
r = RGB24ToARGB(src, src_width * 3, crop_argb, argb_stride, crop_width,
|
||||
r = RGB24ToARGB(src, src_width * 3, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RAW:
|
||||
src = sample + (src_width * crop_y + crop_x) * 3;
|
||||
r = RAWToARGB(src, src_width * 3, crop_argb, argb_stride, crop_width,
|
||||
r = RAWToARGB(src, src_width * 3, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_ARGB:
|
||||
if (!need_buf && !rotation) {
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = ARGBToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = ARGBToARGB(src, src_width * 4, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
}
|
||||
break;
|
||||
case FOURCC_BGRA:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = BGRAToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
|
||||
r = BGRAToARGB(src, src_width * 4, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_ABGR:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = ABGRToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
|
||||
r = ABGRToARGB(src, src_width * 4, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RGBA:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = RGBAToARGB(src, src_width * 4, crop_argb, argb_stride, crop_width,
|
||||
r = RGBAToARGB(src, src_width * 4, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RGBP:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = RGB565ToARGB(src, src_width * 2, crop_argb, argb_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = RGB565ToARGB(src, src_width * 2, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RGBO:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = ARGB1555ToARGB(src, src_width * 2, crop_argb, argb_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = ARGB1555ToARGB(src, src_width * 2, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_R444:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = ARGB4444ToARGB(src, src_width * 2, crop_argb, argb_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = ARGB4444ToARGB(src, src_width * 2, dst_argb, dst_stride_argb,
|
||||
crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_I400:
|
||||
src = sample + src_width * crop_y + crop_x;
|
||||
r = I400ToARGB(src, src_width, crop_argb, argb_stride, crop_width,
|
||||
r = I400ToARGB(src, src_width, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
|
||||
@ -148,19 +148,19 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
case FOURCC_NV12:
|
||||
src = sample + (src_width * crop_y + crop_x);
|
||||
src_uv = sample + aligned_src_width * (src_height + crop_y / 2) + crop_x;
|
||||
r = NV12ToARGB(src, src_width, src_uv, aligned_src_width, crop_argb,
|
||||
argb_stride, crop_width, inv_crop_height);
|
||||
r = NV12ToARGB(src, src_width, src_uv, aligned_src_width, dst_argb,
|
||||
dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_NV21:
|
||||
src = sample + (src_width * crop_y + crop_x);
|
||||
src_uv = sample + aligned_src_width * (src_height + crop_y / 2) + crop_x;
|
||||
// Call NV12 but with u and v parameters swapped.
|
||||
r = NV21ToARGB(src, src_width, src_uv, aligned_src_width, crop_argb,
|
||||
argb_stride, crop_width, inv_crop_height);
|
||||
r = NV21ToARGB(src, src_width, src_uv, aligned_src_width, dst_argb,
|
||||
dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
case FOURCC_M420:
|
||||
src = sample + (src_width * crop_y) * 12 / 8 + crop_x;
|
||||
r = M420ToARGB(src, src_width, crop_argb, argb_stride, crop_width,
|
||||
r = M420ToARGB(src, src_width, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
// Triplanar formats
|
||||
@ -183,7 +183,7 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
halfwidth * (halfheight + crop_y / 2) + crop_x / 2;
|
||||
}
|
||||
r = I420ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth,
|
||||
crop_argb, argb_stride, crop_width, inv_crop_height);
|
||||
dst_argb, dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
src_v = sample + src_width * abs_src_height +
|
||||
halfwidth * (halfheight + crop_y / 2) + crop_x / 2;
|
||||
r = J420ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth,
|
||||
crop_argb, argb_stride, crop_width, inv_crop_height);
|
||||
dst_argb, dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
halfwidth * (abs_src_height + crop_y) + crop_x / 2;
|
||||
}
|
||||
r = I422ToARGB(src_y, src_width, src_u, halfwidth, src_v, halfwidth,
|
||||
crop_argb, argb_stride, crop_width, inv_crop_height);
|
||||
dst_argb, dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
case FOURCC_I444:
|
||||
@ -236,12 +236,12 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
src_v = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
|
||||
}
|
||||
r = I444ToARGB(src_y, src_width, src_u, src_width, src_v, src_width,
|
||||
crop_argb, argb_stride, crop_width, inv_crop_height);
|
||||
dst_argb, dst_stride_argb, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_JPEG
|
||||
case FOURCC_MJPG:
|
||||
r = MJPGToARGB(sample, sample_size, crop_argb, argb_stride, src_width,
|
||||
r = MJPGToARGB(sample, sample_size, dst_argb, dst_stride_argb, src_width,
|
||||
abs_src_height, crop_width, inv_crop_height);
|
||||
break;
|
||||
#endif
|
||||
@ -251,13 +251,13 @@ int ConvertToARGB(const uint8_t* sample,
|
||||
|
||||
if (need_buf) {
|
||||
if (!r) {
|
||||
r = ARGBRotate(crop_argb, argb_stride, dest_argb, dest_argb_stride,
|
||||
r = ARGBRotate(dst_argb, dst_stride_argb, dest_argb, dest_dst_stride_argb,
|
||||
crop_width, abs_crop_height, rotation);
|
||||
}
|
||||
free(rotate_buffer);
|
||||
} else if (rotation) {
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = ARGBRotate(src, src_width * 4, crop_argb, argb_stride, crop_width,
|
||||
r = ARGBRotate(src, src_width * 4, dst_argb, dst_stride_argb, crop_width,
|
||||
inv_crop_height, rotation);
|
||||
}
|
||||
|
||||
|
||||
@ -27,12 +27,12 @@ extern "C" {
|
||||
LIBYUV_API
|
||||
int ConvertToI420(const uint8_t* sample,
|
||||
size_t sample_size,
|
||||
uint8_t* y,
|
||||
int y_stride,
|
||||
uint8_t* u,
|
||||
int u_stride,
|
||||
uint8_t* v,
|
||||
int v_stride,
|
||||
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 crop_x,
|
||||
int crop_y,
|
||||
int src_width,
|
||||
@ -52,26 +52,26 @@ int ConvertToI420(const uint8_t* sample,
|
||||
LIBYUV_BOOL need_buf =
|
||||
(rotation && format != FOURCC_I420 && format != FOURCC_NV12 &&
|
||||
format != FOURCC_NV21 && format != FOURCC_YV12) ||
|
||||
y == sample;
|
||||
uint8_t* tmp_y = y;
|
||||
uint8_t* tmp_u = u;
|
||||
uint8_t* tmp_v = v;
|
||||
int tmp_y_stride = y_stride;
|
||||
int tmp_u_stride = u_stride;
|
||||
int tmp_v_stride = v_stride;
|
||||
dst_y == sample;
|
||||
uint8_t* tmp_y = dst_y;
|
||||
uint8_t* tmp_u = dst_u;
|
||||
uint8_t* tmp_v = dst_v;
|
||||
int tmp_y_stride = dst_stride_y;
|
||||
int tmp_u_stride = dst_stride_u;
|
||||
int tmp_v_stride = dst_stride_v;
|
||||
uint8_t* rotate_buffer = NULL;
|
||||
const int inv_crop_height =
|
||||
(src_height < 0) ? -abs_crop_height : abs_crop_height;
|
||||
|
||||
if (!y || !u || !v || !sample || src_width <= 0 || crop_width <= 0 ||
|
||||
src_height == 0 || crop_height == 0) {
|
||||
if (!dst_y || !dst_u || !dst_v || !sample || src_width <= 0 ||
|
||||
crop_width <= 0 || src_height == 0 || crop_height == 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// One pass rotation is available for some formats. For the rest, convert
|
||||
// to I420 (with optional vertical flipping) into a temporary I420 buffer,
|
||||
// and then rotate the I420 to the final destination buffer.
|
||||
// For in-place conversion, if destination y is same as source sample,
|
||||
// For in-place conversion, if destination dst_y is same as source sample,
|
||||
// also enable temporary buffer.
|
||||
if (need_buf) {
|
||||
int y_size = crop_width * abs_crop_height;
|
||||
@ -80,97 +80,108 @@ int ConvertToI420(const uint8_t* sample,
|
||||
if (!rotate_buffer) {
|
||||
return 1; // Out of memory runtime error.
|
||||
}
|
||||
y = rotate_buffer;
|
||||
u = y + y_size;
|
||||
v = u + uv_size;
|
||||
y_stride = crop_width;
|
||||
u_stride = v_stride = ((crop_width + 1) / 2);
|
||||
dst_y = rotate_buffer;
|
||||
dst_u = dst_y + y_size;
|
||||
dst_v = dst_u + uv_size;
|
||||
dst_stride_y = crop_width;
|
||||
dst_stride_u = dst_stride_v = ((crop_width + 1) / 2);
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
// Single plane formats
|
||||
case FOURCC_YUY2:
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = YUY2ToI420(src, aligned_src_width * 2, y, y_stride, u, u_stride, v,
|
||||
v_stride, crop_width, inv_crop_height);
|
||||
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);
|
||||
break;
|
||||
case FOURCC_UYVY:
|
||||
src = sample + (aligned_src_width * crop_y + crop_x) * 2;
|
||||
r = UYVYToI420(src, aligned_src_width * 2, y, y_stride, u, u_stride, v,
|
||||
v_stride, crop_width, inv_crop_height);
|
||||
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);
|
||||
break;
|
||||
case FOURCC_RGBP:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = RGB565ToI420(src, src_width * 2, y, y_stride, u, u_stride, v,
|
||||
v_stride, crop_width, inv_crop_height);
|
||||
r = RGB565ToI420(src, src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RGBO:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = ARGB1555ToI420(src, src_width * 2, y, y_stride, u, u_stride, v,
|
||||
v_stride, crop_width, inv_crop_height);
|
||||
r = ARGB1555ToI420(src, src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_R444:
|
||||
src = sample + (src_width * crop_y + crop_x) * 2;
|
||||
r = ARGB4444ToI420(src, src_width * 2, y, y_stride, u, u_stride, v,
|
||||
v_stride, crop_width, inv_crop_height);
|
||||
r = ARGB4444ToI420(src, src_width * 2, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_24BG:
|
||||
src = sample + (src_width * crop_y + crop_x) * 3;
|
||||
r = RGB24ToI420(src, src_width * 3, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = RGB24ToI420(src, src_width * 3, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RAW:
|
||||
src = sample + (src_width * crop_y + crop_x) * 3;
|
||||
r = RAWToI420(src, src_width * 3, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = RAWToI420(src, src_width * 3, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_ARGB:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = ARGBToI420(src, src_width * 4, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = ARGBToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_BGRA:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = BGRAToI420(src, src_width * 4, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = BGRAToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_ABGR:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = ABGRToI420(src, src_width * 4, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = ABGRToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_RGBA:
|
||||
src = sample + (src_width * crop_y + crop_x) * 4;
|
||||
r = RGBAToI420(src, src_width * 4, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = RGBAToI420(src, src_width * 4, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, crop_width,
|
||||
inv_crop_height);
|
||||
break;
|
||||
case FOURCC_I400:
|
||||
src = sample + src_width * crop_y + crop_x;
|
||||
r = I400ToI420(src, src_width, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = I400ToI420(src, src_width, dst_y, dst_stride_y, dst_u, dst_stride_u,
|
||||
dst_v, dst_stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
// Biplanar formats
|
||||
case FOURCC_NV12:
|
||||
src = sample + (src_width * crop_y + crop_x);
|
||||
src_uv = sample + (src_width * src_height) +
|
||||
((crop_y / 2) * aligned_src_width) + ((crop_x / 2) * 2);
|
||||
r = NV12ToI420Rotate(src, src_width, src_uv, aligned_src_width, y,
|
||||
y_stride, u, u_stride, v, v_stride, crop_width,
|
||||
inv_crop_height, rotation);
|
||||
r = NV12ToI420Rotate(src, src_width, src_uv, aligned_src_width, dst_y,
|
||||
dst_stride_y, dst_u, dst_stride_u, dst_v,
|
||||
dst_stride_v, crop_width, inv_crop_height, rotation);
|
||||
break;
|
||||
case FOURCC_NV21:
|
||||
src = sample + (src_width * crop_y + crop_x);
|
||||
src_uv = sample + (src_width * src_height) +
|
||||
((crop_y / 2) * aligned_src_width) + ((crop_x / 2) * 2);
|
||||
// Call NV12 but with u and v parameters swapped.
|
||||
r = NV12ToI420Rotate(src, src_width, src_uv, aligned_src_width, y,
|
||||
y_stride, v, v_stride, u, u_stride, crop_width,
|
||||
inv_crop_height, rotation);
|
||||
// Call NV12 but with dst_u and dst_v parameters swapped.
|
||||
r = NV12ToI420Rotate(src, src_width, src_uv, aligned_src_width, dst_y,
|
||||
dst_stride_y, dst_v, dst_stride_v, dst_u,
|
||||
dst_stride_u, crop_width, inv_crop_height, rotation);
|
||||
break;
|
||||
case FOURCC_M420:
|
||||
src = sample + (src_width * crop_y) * 12 / 8 + crop_x;
|
||||
r = M420ToI420(src, src_width, y, y_stride, u, u_stride, v, v_stride,
|
||||
crop_width, inv_crop_height);
|
||||
r = M420ToI420(src, src_width, dst_y, dst_stride_y, dst_u, dst_stride_u,
|
||||
dst_v, dst_stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
// Triplanar formats
|
||||
case FOURCC_I420:
|
||||
@ -191,9 +202,9 @@ int ConvertToI420(const uint8_t* sample,
|
||||
src_v = sample + src_width * abs_src_height +
|
||||
halfwidth * (halfheight + crop_y / 2) + crop_x / 2;
|
||||
}
|
||||
r = I420Rotate(src_y, src_width, src_u, halfwidth, src_v, halfwidth, y,
|
||||
y_stride, u, u_stride, v, v_stride, crop_width,
|
||||
inv_crop_height, rotation);
|
||||
r = I420Rotate(src_y, src_width, src_u, halfwidth, src_v, halfwidth,
|
||||
dst_y, dst_stride_y, dst_u, dst_stride_u, dst_v,
|
||||
dst_stride_v, crop_width, inv_crop_height, rotation);
|
||||
break;
|
||||
}
|
||||
case FOURCC_I422:
|
||||
@ -213,9 +224,9 @@ int ConvertToI420(const uint8_t* sample,
|
||||
src_v = sample + src_width * abs_src_height +
|
||||
halfwidth * (abs_src_height + crop_y) + crop_x / 2;
|
||||
}
|
||||
r = I422ToI420(src_y, src_width, src_u, halfwidth, src_v, halfwidth, y,
|
||||
y_stride, u, u_stride, v, v_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = I422ToI420(src_y, src_width, src_u, halfwidth, src_v, halfwidth,
|
||||
dst_y, dst_stride_y, dst_u, dst_stride_u, dst_v,
|
||||
dst_stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
case FOURCC_I444:
|
||||
@ -230,15 +241,16 @@ int ConvertToI420(const uint8_t* sample,
|
||||
src_u = sample + src_width * (abs_src_height + crop_y) + crop_x;
|
||||
src_v = sample + src_width * (abs_src_height * 2 + crop_y) + crop_x;
|
||||
}
|
||||
r = I444ToI420(src_y, src_width, src_u, src_width, src_v, src_width, y,
|
||||
y_stride, u, u_stride, v, v_stride, crop_width,
|
||||
inv_crop_height);
|
||||
r = I444ToI420(src_y, src_width, src_u, src_width, src_v, src_width,
|
||||
dst_y, dst_stride_y, dst_u, dst_stride_u, dst_v,
|
||||
dst_stride_v, crop_width, inv_crop_height);
|
||||
break;
|
||||
}
|
||||
#ifdef HAVE_JPEG
|
||||
case FOURCC_MJPG:
|
||||
r = MJPGToI420(sample, sample_size, y, y_stride, u, u_stride, v, v_stride,
|
||||
src_width, abs_src_height, crop_width, inv_crop_height);
|
||||
r = MJPGToI420(sample, sample_size, dst_y, dst_stride_y, dst_u,
|
||||
dst_stride_u, dst_v, dst_stride_v, src_width,
|
||||
abs_src_height, crop_width, inv_crop_height);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
@ -247,9 +259,10 @@ int ConvertToI420(const uint8_t* sample,
|
||||
|
||||
if (need_buf) {
|
||||
if (!r) {
|
||||
r = I420Rotate(y, y_stride, u, u_stride, v, v_stride, tmp_y, tmp_y_stride,
|
||||
tmp_u, tmp_u_stride, tmp_v, tmp_v_stride, crop_width,
|
||||
abs_crop_height, rotation);
|
||||
r = I420Rotate(dst_y, dst_stride_y, dst_u, dst_stride_u, dst_v,
|
||||
dst_stride_v, tmp_y, tmp_y_stride, tmp_u, tmp_u_stride,
|
||||
tmp_v, tmp_v_stride, crop_width, abs_crop_height,
|
||||
rotation);
|
||||
}
|
||||
free(rotate_buffer);
|
||||
}
|
||||
|
||||
@ -3219,9 +3219,9 @@ int ARGBCopyAlpha(const uint8_t* src_argb,
|
||||
// Extract just the alpha channel from ARGB.
|
||||
LIBYUV_API
|
||||
int ARGBExtractAlpha(const uint8_t* src_argb,
|
||||
int src_stride,
|
||||
int src_stride_argb,
|
||||
uint8_t* dst_a,
|
||||
int dst_stride,
|
||||
int dst_stride_a,
|
||||
int width,
|
||||
int height) {
|
||||
if (!src_argb || !dst_a || width <= 0 || height == 0) {
|
||||
@ -3230,14 +3230,14 @@ int ARGBExtractAlpha(const uint8_t* src_argb,
|
||||
// Negative height means invert the image.
|
||||
if (height < 0) {
|
||||
height = -height;
|
||||
src_argb += (height - 1) * src_stride;
|
||||
src_stride = -src_stride;
|
||||
src_argb += (height - 1) * src_stride_argb;
|
||||
src_stride_argb = -src_stride_argb;
|
||||
}
|
||||
// Coalesce rows.
|
||||
if (src_stride == width * 4 && dst_stride == width) {
|
||||
if (src_stride_argb == width * 4 && dst_stride_a == width) {
|
||||
width *= height;
|
||||
height = 1;
|
||||
src_stride = dst_stride = 0;
|
||||
src_stride_argb = dst_stride_a = 0;
|
||||
}
|
||||
void (*ARGBExtractAlphaRow)(const uint8_t* src_argb, uint8_t* dst_a,
|
||||
int width) = ARGBExtractAlphaRow_C;
|
||||
@ -3268,8 +3268,8 @@ int ARGBExtractAlpha(const uint8_t* src_argb,
|
||||
|
||||
for (int y = 0; y < height; ++y) {
|
||||
ARGBExtractAlphaRow(src_argb, dst_a, width);
|
||||
src_argb += src_stride;
|
||||
dst_a += dst_stride;
|
||||
src_argb += src_stride_argb;
|
||||
dst_a += dst_stride_a;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3626,7 +3626,7 @@ void MergeRGBRow_SSSE3(const uint8_t* src_r,
|
||||
#endif // HAS_MERGERGBROW_SSSE3
|
||||
|
||||
#ifdef HAS_COPYROW_SSE2
|
||||
void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int count) {
|
||||
void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
"test $0xf,%0 \n"
|
||||
"jne 2f \n"
|
||||
@ -3659,14 +3659,14 @@ void CopyRow_SSE2(const uint8_t* src, uint8_t* dst, int count) {
|
||||
LABELALIGN "9: \n"
|
||||
: "+r"(src), // %0
|
||||
"+r"(dst), // %1
|
||||
"+r"(count) // %2
|
||||
"+r"(width) // %2
|
||||
:
|
||||
: "memory", "cc", "xmm0", "xmm1");
|
||||
}
|
||||
#endif // HAS_COPYROW_SSE2
|
||||
|
||||
#ifdef HAS_COPYROW_AVX
|
||||
void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int count) {
|
||||
void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
|
||||
LABELALIGN
|
||||
@ -3681,7 +3681,7 @@ void CopyRow_AVX(const uint8_t* src, uint8_t* dst, int count) {
|
||||
"jg 1b \n"
|
||||
: "+r"(src), // %0
|
||||
"+r"(dst), // %1
|
||||
"+r"(count) // %2
|
||||
"+r"(width) // %2
|
||||
:
|
||||
: "memory", "cc", "xmm0", "xmm1");
|
||||
}
|
||||
|
||||
@ -370,7 +370,7 @@ void I422ToUYVYRow_MSA(const uint8_t* src_y,
|
||||
void I422ToARGBRow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -390,18 +390,18 @@ void I422ToARGBRow_MSA(const uint8_t* src_y,
|
||||
src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
|
||||
YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
|
||||
vec0, vec1, vec2);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, rgb_buf);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
|
||||
src_y += 8;
|
||||
src_u += 4;
|
||||
src_v += 4;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void I422ToRGBARow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -421,11 +421,11 @@ void I422ToRGBARow_MSA(const uint8_t* src_y,
|
||||
src1 = (v16u8)__msa_ilvr_b((v16i8)src2, (v16i8)src1);
|
||||
YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
|
||||
vec0, vec1, vec2);
|
||||
STOREARGB(alpha, vec0, vec1, vec2, rgb_buf);
|
||||
STOREARGB(alpha, vec0, vec1, vec2, dst_argb);
|
||||
src_y += 8;
|
||||
src_u += 4;
|
||||
src_v += 4;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
@ -433,7 +433,7 @@ void I422AlphaToARGBRow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
const uint8_t* src_a,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -457,19 +457,19 @@ void I422AlphaToARGBRow_MSA(const uint8_t* src_y,
|
||||
YUVTORGB(src0, src1, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
|
||||
vec0, vec1, vec2);
|
||||
src3 = (v16u8)__msa_ilvr_b((v16i8)src3, (v16i8)src3);
|
||||
STOREARGB(vec0, vec1, vec2, src3, rgb_buf);
|
||||
STOREARGB(vec0, vec1, vec2, src3, dst_argb);
|
||||
src_y += 8;
|
||||
src_u += 4;
|
||||
src_v += 4;
|
||||
src_a += 8;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void I422ToRGB24Row_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int32_t width) {
|
||||
int x;
|
||||
@ -510,12 +510,12 @@ void I422ToRGB24Row_MSA(const uint8_t* src_y,
|
||||
dst0 = (v16u8)__msa_vshf_b(shuffler0, (v16i8)reg3, (v16i8)reg0);
|
||||
dst1 = (v16u8)__msa_vshf_b(shuffler1, (v16i8)reg3, (v16i8)reg1);
|
||||
dst2 = (v16u8)__msa_vshf_b(shuffler2, (v16i8)reg3, (v16i8)reg2);
|
||||
ST_UB2(dst0, dst1, rgb_buf, 16);
|
||||
ST_UB(dst2, (rgb_buf + 32));
|
||||
ST_UB2(dst0, dst1, dst_argb, 16);
|
||||
ST_UB(dst2, (dst_argb + 32));
|
||||
src_y += 16;
|
||||
src_u += 8;
|
||||
src_v += 8;
|
||||
rgb_buf += 48;
|
||||
dst_argb += 48;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2229,7 +2229,7 @@ void RAWToUVRow_MSA(const uint8_t* src_rgb0,
|
||||
|
||||
void NV12ToARGBRow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_uv,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2257,16 +2257,16 @@ void NV12ToARGBRow_MSA(const uint8_t* src_y,
|
||||
res1 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)vec1);
|
||||
dst0 = (v16u8)__msa_ilvr_b((v16i8)res1, (v16i8)res0);
|
||||
dst1 = (v16u8)__msa_ilvl_b((v16i8)res1, (v16i8)res0);
|
||||
ST_UB2(dst0, dst1, rgb_buf, 16);
|
||||
ST_UB2(dst0, dst1, dst_argb, 16);
|
||||
src_y += 8;
|
||||
src_uv += 8;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void NV12ToRGB565Row_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_uv,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_rgb565,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2293,16 +2293,16 @@ void NV12ToRGB565Row_MSA(const uint8_t* src_y,
|
||||
vec1 = (vec1 >> 2) << 5;
|
||||
vec2 = (vec2 >> 3) << 11;
|
||||
dst0 = (v16u8)(vec0 | vec1 | vec2);
|
||||
ST_UB(dst0, rgb_buf);
|
||||
ST_UB(dst0, dst_rgb565);
|
||||
src_y += 8;
|
||||
src_uv += 8;
|
||||
rgb_buf += 16;
|
||||
dst_rgb565 += 16;
|
||||
}
|
||||
}
|
||||
|
||||
void NV21ToARGBRow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_vu,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2332,10 +2332,10 @@ void NV21ToARGBRow_MSA(const uint8_t* src_y,
|
||||
res1 = (v16u8)__msa_ilvev_b((v16i8)alpha, (v16i8)vec1);
|
||||
dst0 = (v16u8)__msa_ilvr_b((v16i8)res1, (v16i8)res0);
|
||||
dst1 = (v16u8)__msa_ilvl_b((v16i8)res1, (v16i8)res0);
|
||||
ST_UB2(dst0, dst1, rgb_buf, 16);
|
||||
ST_UB2(dst0, dst1, dst_argb, 16);
|
||||
src_y += 8;
|
||||
src_vu += 8;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2669,7 +2669,7 @@ void RGBAToUVRow_MSA(const uint8_t* src_rgb0,
|
||||
void I444ToARGBRow_MSA(const uint8_t* src_y,
|
||||
const uint8_t* src_u,
|
||||
const uint8_t* src_v,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2726,15 +2726,15 @@ void I444ToARGBRow_MSA(const uint8_t* src_y,
|
||||
vec1 = (v8u16)__msa_ilvev_b((v16i8)alpha, (v16i8)vec2);
|
||||
dst0 = (v16u8)__msa_ilvr_h((v8i16)vec1, (v8i16)vec0);
|
||||
dst1 = (v16u8)__msa_ilvl_h((v8i16)vec1, (v8i16)vec0);
|
||||
ST_UB2(dst0, dst1, rgb_buf, 16);
|
||||
ST_UB2(dst0, dst1, dst_argb, 16);
|
||||
src_y += 8;
|
||||
src_u += 8;
|
||||
src_v += 8;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void I400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* rgb_buf, int width) {
|
||||
void I400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* dst_argb, int width) {
|
||||
int x;
|
||||
v16u8 src0, res0, res1, res2, res3, res4, dst0, dst1, dst2, dst3;
|
||||
v8i16 vec0, vec1;
|
||||
@ -2780,9 +2780,9 @@ void I400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* rgb_buf, int width) {
|
||||
dst1 = (v16u8)__msa_ilvl_b((v16i8)res3, (v16i8)res1);
|
||||
dst2 = (v16u8)__msa_ilvr_b((v16i8)res4, (v16i8)res2);
|
||||
dst3 = (v16u8)__msa_ilvl_b((v16i8)res4, (v16i8)res2);
|
||||
ST_UB4(dst0, dst1, dst2, dst3, rgb_buf, 16);
|
||||
ST_UB4(dst0, dst1, dst2, dst3, dst_argb, 16);
|
||||
src_y += 16;
|
||||
rgb_buf += 64;
|
||||
dst_argb += 64;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2808,7 +2808,7 @@ void J400ToARGBRow_MSA(const uint8_t* src_y, uint8_t* dst_argb, int width) {
|
||||
}
|
||||
|
||||
void YUY2ToARGBRow_MSA(const uint8_t* src_yuy2,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2829,14 +2829,14 @@ void YUY2ToARGBRow_MSA(const uint8_t* src_yuy2,
|
||||
src2 = (v16u8)__msa_pckod_b((v16i8)src0, (v16i8)src0);
|
||||
YUVTORGB(src1, src2, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
|
||||
vec0, vec1, vec2);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, rgb_buf);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
|
||||
src_yuy2 += 16;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
void UYVYToARGBRow_MSA(const uint8_t* src_uyvy,
|
||||
uint8_t* rgb_buf,
|
||||
uint8_t* dst_argb,
|
||||
const struct YuvConstants* yuvconstants,
|
||||
int width) {
|
||||
int x;
|
||||
@ -2857,9 +2857,9 @@ void UYVYToARGBRow_MSA(const uint8_t* src_uyvy,
|
||||
src2 = (v16u8)__msa_pckev_b((v16i8)src0, (v16i8)src0);
|
||||
YUVTORGB(src1, src2, vec_ubvr, vec_ugvg, vec_bb, vec_bg, vec_br, vec_yg,
|
||||
vec0, vec1, vec2);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, rgb_buf);
|
||||
STOREARGB(vec0, vec1, vec2, alpha, dst_argb);
|
||||
src_uyvy += 16;
|
||||
rgb_buf += 32;
|
||||
dst_argb += 32;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -584,7 +584,7 @@ void MergeRGBRow_NEON(const uint8_t* src_r,
|
||||
}
|
||||
|
||||
// Copy multiple of 32. vld4.8 allow unaligned and is fastest on a15.
|
||||
void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int count) {
|
||||
void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"vld1.8 {d0, d1, d2, d3}, [%0]! \n" // load 32
|
||||
@ -593,14 +593,14 @@ void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int count) {
|
||||
"bgt 1b \n"
|
||||
: "+r"(src), // %0
|
||||
"+r"(dst), // %1
|
||||
"+r"(count) // %2 // Output registers
|
||||
"+r"(width) // %2 // Output registers
|
||||
: // Input registers
|
||||
: "cc", "memory", "q0", "q1" // Clobber List
|
||||
);
|
||||
}
|
||||
|
||||
// SetRow writes 'count' bytes using an 8 bit value repeated.
|
||||
void SetRow_NEON(uint8_t* dst, uint8_t v8, int count) {
|
||||
// SetRow writes 'width' bytes using an 8 bit value repeated.
|
||||
void SetRow_NEON(uint8_t* dst, uint8_t v8, int width) {
|
||||
asm volatile(
|
||||
"vdup.8 q0, %2 \n" // duplicate 16 bytes
|
||||
"1: \n"
|
||||
@ -608,13 +608,13 @@ void SetRow_NEON(uint8_t* dst, uint8_t v8, int count) {
|
||||
"vst1.8 {q0}, [%0]! \n" // store
|
||||
"bgt 1b \n"
|
||||
: "+r"(dst), // %0
|
||||
"+r"(count) // %1
|
||||
"+r"(width) // %1
|
||||
: "r"(v8) // %2
|
||||
: "cc", "memory", "q0");
|
||||
}
|
||||
|
||||
// ARGBSetRow writes 'count' pixels using an 32 bit value repeated.
|
||||
void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int count) {
|
||||
// ARGBSetRow writes 'width' pixels using an 32 bit value repeated.
|
||||
void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int width) {
|
||||
asm volatile(
|
||||
"vdup.u32 q0, %2 \n" // duplicate 4 ints
|
||||
"1: \n"
|
||||
@ -622,7 +622,7 @@ void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int count) {
|
||||
"vst1.8 {q0}, [%0]! \n" // store
|
||||
"bgt 1b \n"
|
||||
: "+r"(dst), // %0
|
||||
"+r"(count) // %1
|
||||
"+r"(width) // %1
|
||||
: "r"(v32) // %2
|
||||
: "cc", "memory", "q0");
|
||||
}
|
||||
@ -2552,7 +2552,10 @@ void SobelYRow_NEON(const uint8_t* src_y0,
|
||||
);
|
||||
}
|
||||
|
||||
void HalfFloat1Row_NEON(const uint16_t* src, uint16_t* dst, float, int width) {
|
||||
void HalfFloat1Row_NEON(const uint16_t* src,
|
||||
uint16_t* dst,
|
||||
float /*unused*/,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"vdup.32 q0, %3 \n"
|
||||
|
||||
|
||||
@ -629,7 +629,7 @@ void MergeRGBRow_NEON(const uint8_t* src_r,
|
||||
}
|
||||
|
||||
// Copy multiple of 32.
|
||||
void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int count) {
|
||||
void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"ldp q0, q1, [%0], #32 \n"
|
||||
@ -638,14 +638,14 @@ void CopyRow_NEON(const uint8_t* src, uint8_t* dst, int count) {
|
||||
"b.gt 1b \n"
|
||||
: "+r"(src), // %0
|
||||
"+r"(dst), // %1
|
||||
"+r"(count) // %2 // Output registers
|
||||
"+r"(width) // %2 // Output registers
|
||||
: // Input registers
|
||||
: "cc", "memory", "v0", "v1" // Clobber List
|
||||
);
|
||||
}
|
||||
|
||||
// SetRow writes 'count' bytes using an 8 bit value repeated.
|
||||
void SetRow_NEON(uint8_t* dst, uint8_t v8, int count) {
|
||||
// SetRow writes 'width' bytes using an 8 bit value repeated.
|
||||
void SetRow_NEON(uint8_t* dst, uint8_t v8, int width) {
|
||||
asm volatile(
|
||||
"dup v0.16b, %w2 \n" // duplicate 16 bytes
|
||||
"1: \n"
|
||||
@ -653,12 +653,12 @@ void SetRow_NEON(uint8_t* dst, uint8_t v8, int count) {
|
||||
"st1 {v0.16b}, [%0], #16 \n" // store
|
||||
"b.gt 1b \n"
|
||||
: "+r"(dst), // %0
|
||||
"+r"(count) // %1
|
||||
"+r"(width) // %1
|
||||
: "r"(v8) // %2
|
||||
: "cc", "memory", "v0");
|
||||
}
|
||||
|
||||
void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int count) {
|
||||
void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int width) {
|
||||
asm volatile(
|
||||
"dup v0.4s, %w2 \n" // duplicate 4 ints
|
||||
"1: \n"
|
||||
@ -666,7 +666,7 @@ void ARGBSetRow_NEON(uint8_t* dst, uint32_t v32, int count) {
|
||||
"st1 {v0.16b}, [%0], #16 \n" // store
|
||||
"b.gt 1b \n"
|
||||
: "+r"(dst), // %0
|
||||
"+r"(count) // %1
|
||||
"+r"(width) // %1
|
||||
: "r"(v32) // %2
|
||||
: "cc", "memory", "v0");
|
||||
}
|
||||
@ -2600,7 +2600,10 @@ void SobelYRow_NEON(const uint8_t* src_y0,
|
||||
}
|
||||
|
||||
// Caveat - rounds float to half float whereas scaling version truncates.
|
||||
void HalfFloat1Row_NEON(const uint16_t* src, uint16_t* dst, float, int width) {
|
||||
void HalfFloat1Row_NEON(const uint16_t* src,
|
||||
uint16_t* dst,
|
||||
float /*unused*/,
|
||||
int width) {
|
||||
asm volatile(
|
||||
"1: \n"
|
||||
"ld1 {v1.16b}, [%0], #16 \n" // load 8 shorts
|
||||
|
||||
@ -3275,14 +3275,14 @@ __declspec(naked) void MergeUVRow_AVX2(const uint8_t* src_u,
|
||||
#endif // HAS_MERGEUVROW_AVX2
|
||||
|
||||
#ifdef HAS_COPYROW_SSE2
|
||||
// CopyRow copys 'count' bytes using a 16 byte load/store, 32 bytes at time.
|
||||
// CopyRow copys 'width' bytes using a 16 byte load/store, 32 bytes at time.
|
||||
__declspec(naked) void CopyRow_SSE2(const uint8_t* src,
|
||||
uint8_t* dst,
|
||||
int count) {
|
||||
int width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
test eax, 15
|
||||
jne convertloopu
|
||||
test edx, 15
|
||||
@ -3314,14 +3314,14 @@ __declspec(naked) void CopyRow_SSE2(const uint8_t* src,
|
||||
#endif // HAS_COPYROW_SSE2
|
||||
|
||||
#ifdef HAS_COPYROW_AVX
|
||||
// CopyRow copys 'count' bytes using a 32 byte load/store, 64 bytes at time.
|
||||
// CopyRow copys 'width' bytes using a 32 byte load/store, 64 bytes at time.
|
||||
__declspec(naked) void CopyRow_AVX(const uint8_t* src,
|
||||
uint8_t* dst,
|
||||
int count) {
|
||||
int width) {
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
|
||||
convertloop:
|
||||
vmovdqu ymm0, [eax]
|
||||
@ -3342,13 +3342,13 @@ __declspec(naked) void CopyRow_AVX(const uint8_t* src,
|
||||
// Multiple of 1.
|
||||
__declspec(naked) void CopyRow_ERMS(const uint8_t* src,
|
||||
uint8_t* dst,
|
||||
int count) {
|
||||
int width) {
|
||||
__asm {
|
||||
mov eax, esi
|
||||
mov edx, edi
|
||||
mov esi, [esp + 4] // src
|
||||
mov edi, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
rep movsb
|
||||
mov edi, edx
|
||||
mov esi, eax
|
||||
@ -3364,7 +3364,7 @@ __declspec(naked) void ARGBCopyAlphaRow_SSE2(const uint8_t* src,
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
pcmpeqb xmm0, xmm0 // generate mask 0xff000000
|
||||
pslld xmm0, 24
|
||||
pcmpeqb xmm1, xmm1 // generate mask 0x00ffffff
|
||||
@ -3401,7 +3401,7 @@ __declspec(naked) void ARGBCopyAlphaRow_AVX2(const uint8_t* src,
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
vpcmpeqb ymm0, ymm0, ymm0
|
||||
vpsrld ymm0, ymm0, 8 // generate mask 0x00ffffff
|
||||
|
||||
@ -3495,7 +3495,7 @@ __declspec(naked) void ARGBCopyYToAlphaRow_SSE2(const uint8_t* src,
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
pcmpeqb xmm0, xmm0 // generate mask 0xff000000
|
||||
pslld xmm0, 24
|
||||
pcmpeqb xmm1, xmm1 // generate mask 0x00ffffff
|
||||
@ -3534,7 +3534,7 @@ __declspec(naked) void ARGBCopyYToAlphaRow_AVX2(const uint8_t* src,
|
||||
__asm {
|
||||
mov eax, [esp + 4] // src
|
||||
mov edx, [esp + 8] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
vpcmpeqb ymm0, ymm0, ymm0
|
||||
vpsrld ymm0, ymm0, 8 // generate mask 0x00ffffff
|
||||
|
||||
@ -3559,16 +3559,16 @@ __declspec(naked) void ARGBCopyYToAlphaRow_AVX2(const uint8_t* src,
|
||||
#endif // HAS_ARGBCOPYYTOALPHAROW_AVX2
|
||||
|
||||
#ifdef HAS_SETROW_X86
|
||||
// Write 'count' bytes using an 8 bit value repeated.
|
||||
// Count should be multiple of 4.
|
||||
__declspec(naked) void SetRow_X86(uint8_t* dst, uint8_t v8, int count) {
|
||||
// Write 'width' bytes using an 8 bit value repeated.
|
||||
// width should be multiple of 4.
|
||||
__declspec(naked) void SetRow_X86(uint8_t* dst, uint8_t v8, int width) {
|
||||
__asm {
|
||||
movzx eax, byte ptr [esp + 8] // v8
|
||||
mov edx, 0x01010101 // Duplicate byte to all bytes.
|
||||
mul edx // overwrites edx with upper part of result.
|
||||
mov edx, edi
|
||||
mov edi, [esp + 4] // dst
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
shr ecx, 2
|
||||
rep stosd
|
||||
mov edi, edx
|
||||
@ -3576,28 +3576,28 @@ __declspec(naked) void SetRow_X86(uint8_t* dst, uint8_t v8, int count) {
|
||||
}
|
||||
}
|
||||
|
||||
// Write 'count' bytes using an 8 bit value repeated.
|
||||
__declspec(naked) void SetRow_ERMS(uint8_t* dst, uint8_t v8, int count) {
|
||||
// Write 'width' bytes using an 8 bit value repeated.
|
||||
__declspec(naked) void SetRow_ERMS(uint8_t* dst, uint8_t v8, int width) {
|
||||
__asm {
|
||||
mov edx, edi
|
||||
mov edi, [esp + 4] // dst
|
||||
mov eax, [esp + 8] // v8
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
rep stosb
|
||||
mov edi, edx
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
// Write 'count' 32 bit values.
|
||||
// Write 'width' 32 bit values.
|
||||
__declspec(naked) void ARGBSetRow_X86(uint8_t* dst_argb,
|
||||
uint32_t v32,
|
||||
int count) {
|
||||
int width) {
|
||||
__asm {
|
||||
mov edx, edi
|
||||
mov edi, [esp + 4] // dst
|
||||
mov eax, [esp + 8] // v32
|
||||
mov ecx, [esp + 12] // count
|
||||
mov ecx, [esp + 12] // width
|
||||
rep stosd
|
||||
mov edi, edx
|
||||
ret
|
||||
|
||||
@ -1735,44 +1735,6 @@ int Scale(const uint8_t* src_y,
|
||||
dst_height, interpolate ? kFilterBox : kFilterNone);
|
||||
}
|
||||
|
||||
// Deprecated api
|
||||
LIBYUV_API
|
||||
int ScaleOffset(const uint8_t* src,
|
||||
int src_width,
|
||||
int src_height,
|
||||
uint8_t* dst,
|
||||
int dst_width,
|
||||
int dst_height,
|
||||
int dst_yoffset,
|
||||
LIBYUV_BOOL interpolate) {
|
||||
// Chroma requires offset to multiple of 2.
|
||||
int dst_yoffset_even = dst_yoffset & ~1;
|
||||
int src_halfwidth = SUBSAMPLE(src_width, 1, 1);
|
||||
int src_halfheight = SUBSAMPLE(src_height, 1, 1);
|
||||
int dst_halfwidth = SUBSAMPLE(dst_width, 1, 1);
|
||||
int dst_halfheight = SUBSAMPLE(dst_height, 1, 1);
|
||||
int aheight = dst_height - dst_yoffset_even * 2; // actual output height
|
||||
const uint8_t* src_y = src;
|
||||
const uint8_t* src_u = src + src_width * src_height;
|
||||
const uint8_t* src_v =
|
||||
src + src_width * src_height + src_halfwidth * src_halfheight;
|
||||
uint8_t* dst_y = dst + dst_yoffset_even * dst_width;
|
||||
uint8_t* dst_u =
|
||||
dst + dst_width * dst_height + (dst_yoffset_even >> 1) * dst_halfwidth;
|
||||
uint8_t* dst_v = dst + dst_width * dst_height +
|
||||
dst_halfwidth * dst_halfheight +
|
||||
(dst_yoffset_even >> 1) * dst_halfwidth;
|
||||
if (!src || src_width <= 0 || src_height <= 0 || !dst || dst_width <= 0 ||
|
||||
dst_height <= 0 || dst_yoffset_even < 0 ||
|
||||
dst_yoffset_even >= dst_height) {
|
||||
return -1;
|
||||
}
|
||||
return I420Scale(src_y, src_width, src_u, src_halfwidth, src_v, src_halfwidth,
|
||||
src_width, src_height, dst_y, dst_width, dst_u,
|
||||
dst_halfwidth, dst_v, dst_halfwidth, dst_width, aheight,
|
||||
interpolate ? kFilterBox : kFilterNone);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
} // namespace libyuv
|
||||
|
||||
@ -31,7 +31,9 @@ static const double kMaxPSNR = 128.0;
|
||||
#if !defined(HAVE_JPEG)
|
||||
// Computer Sum of Squared Error (SSE).
|
||||
// Pass this to ComputePSNR for final result.
|
||||
double ComputeSumSquareError(const uint8_t* org, const uint8_t* rec, int size);
|
||||
double ComputeSumSquareError(const uint8_t* src_a,
|
||||
const uint8_t* src_b,
|
||||
int count);
|
||||
#endif
|
||||
|
||||
// PSNR formula: psnr = 10 * log10 (Peak Signal^2 * size / sse)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user