#include "libyuv/row.h"
#include <assert.h>
#include <string.h>
#include "libyuv/basic_types.h"
#include "libyuv/convert_argb.h"
#ifdef __cplusplus
namespace libyuv {
extern "C" {
#endif
#ifdef __cplusplus
#define STATIC_CAST …
#else
#define STATIC_CAST …
#endif
#if !defined(LIBYUV_BIT_EXACT) && !defined(LIBYUV_DISABLE_X86) && \
defined(_MSC_VER) && !defined(__clang__) && \
(defined(_M_IX86) || defined(_M_X64))
#define LIBYUV_RGB7 …
#endif
#if !defined(LIBYUV_BIT_EXACT) && (defined(__x86_64__) || defined(_M_X64) || \
defined(__i386__) || defined(_M_IX86))
#define LIBYUV_ARGBTOUV_PAVGB …
#define LIBYUV_RGBTOU_TRUNCATE …
#endif
#if defined(LIBYUV_BIT_EXACT)
#define LIBYUV_UNATTENUATE_DUP …
#endif
#define USE_BRANCHLESS …
#if defined(USE_BRANCHLESS)
static __inline int32_t clamp0(int32_t v) { … }
static __inline int32_t clamp255(int32_t v) { … }
static __inline int32_t clamp1023(int32_t v) { … }
static __inline int32_t ClampMax(int32_t v, int32_t max) { … }
static __inline uint32_t Abs(int32_t v) { … }
#else
static __inline int32_t clamp0(int32_t v) {
return (v < 0) ? 0 : v;
}
static __inline int32_t clamp255(int32_t v) {
return (v > 255) ? 255 : v;
}
static __inline int32_t clamp1023(int32_t v) {
return (v > 1023) ? 1023 : v;
}
static __inline int32_t ClampMax(int32_t v, int32_t max) {
return (v > max) ? max : v;
}
static __inline uint32_t Abs(int32_t v) {
return (v < 0) ? -v : v;
}
#endif
static __inline uint32_t Clamp(int32_t val) { … }
static __inline uint32_t Clamp10(int32_t val) { … }
#if defined(__x86_64__) || defined(_M_X64) || defined(__i386__) || \
defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) || \
(defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
#define WRITEWORD(p, v) …
#else
static inline void WRITEWORD(uint8_t* p, uint32_t v) {
p[0] = (uint8_t)(v & 255);
p[1] = (uint8_t)((v >> 8) & 255);
p[2] = (uint8_t)((v >> 16) & 255);
p[3] = (uint8_t)((v >> 24) & 255);
}
#endif
void RGB24ToARGBRow_C(const uint8_t* src_rgb24, uint8_t* dst_argb, int width) { … }
void RAWToARGBRow_C(const uint8_t* src_raw, uint8_t* dst_argb, int width) { … }
void RAWToRGBARow_C(const uint8_t* src_raw, uint8_t* dst_rgba, int width) { … }
void RAWToRGB24Row_C(const uint8_t* src_raw, uint8_t* dst_rgb24, int width) { … }
void RGB565ToARGBRow_C(const uint8_t* src_rgb565,
uint8_t* dst_argb,
int width) { … }
void ARGB1555ToARGBRow_C(const uint8_t* src_argb1555,
uint8_t* dst_argb,
int width) { … }
void ARGB4444ToARGBRow_C(const uint8_t* src_argb4444,
uint8_t* dst_argb,
int width) { … }
void AR30ToARGBRow_C(const uint8_t* src_ar30, uint8_t* dst_argb, int width) { … }
void AR30ToABGRRow_C(const uint8_t* src_ar30, uint8_t* dst_abgr, int width) { … }
void AR30ToAB30Row_C(const uint8_t* src_ar30, uint8_t* dst_ab30, int width) { … }
void ARGBToABGRRow_C(const uint8_t* src_argb, uint8_t* dst_abgr, int width) { … }
void ARGBToBGRARow_C(const uint8_t* src_argb, uint8_t* dst_bgra, int width) { … }
void ARGBToRGBARow_C(const uint8_t* src_argb, uint8_t* dst_rgba, int width) { … }
void ARGBToRGB24Row_C(const uint8_t* src_argb, uint8_t* dst_rgb, int width) { … }
void ARGBToRAWRow_C(const uint8_t* src_argb, uint8_t* dst_rgb, int width) { … }
void RGBAToARGBRow_C(const uint8_t* src_rgba, uint8_t* dst_argb, int width) { … }
void ARGBToRGB565Row_C(const uint8_t* src_argb, uint8_t* dst_rgb, int width) { … }
void ARGBToRGB565DitherRow_C(const uint8_t* src_argb,
uint8_t* dst_rgb,
uint32_t dither4,
int width) { … }
void ARGBToARGB1555Row_C(const uint8_t* src_argb, uint8_t* dst_rgb, int width) { … }
void ARGBToARGB4444Row_C(const uint8_t* src_argb, uint8_t* dst_rgb, int width) { … }
void ABGRToAR30Row_C(const uint8_t* src_abgr, uint8_t* dst_ar30, int width) { … }
void ARGBToAR30Row_C(const uint8_t* src_argb, uint8_t* dst_ar30, int width) { … }
void ARGBToAR64Row_C(const uint8_t* src_argb, uint16_t* dst_ar64, int width) { … }
void ARGBToAB64Row_C(const uint8_t* src_argb, uint16_t* dst_ab64, int width) { … }
void AR64ToARGBRow_C(const uint16_t* src_ar64, uint8_t* dst_argb, int width) { … }
void AB64ToARGBRow_C(const uint16_t* src_ab64, uint8_t* dst_argb, int width) { … }
void AR64ToAB64Row_C(const uint16_t* src_ar64, uint16_t* dst_ab64, int width) { … }
void AR64ShuffleRow_C(const uint8_t* src_ar64,
uint8_t* dst_ar64,
const uint8_t* shuffler,
int width) { … }
#ifdef LIBYUV_RGB7
static __inline uint8_t RGBToY(uint8_t r, uint8_t g, uint8_t b) {
return STATIC_CAST(uint8_t, ((33 * r + 65 * g + 13 * b) >> 7) + 16);
}
#else
static __inline uint8_t RGBToY(uint8_t r, uint8_t g, uint8_t b) { … }
#endif
#define AVGB(a, b) …
#ifdef LIBYUV_RGBTOU_TRUNCATE
static __inline uint8_t RGBToU(uint8_t r, uint8_t g, uint8_t b) { … }
static __inline uint8_t RGBToV(uint8_t r, uint8_t g, uint8_t b) { … }
#else
static __inline uint8_t RGBToU(uint8_t r, uint8_t g, uint8_t b) {
return STATIC_CAST(uint8_t, (112 * b - 74 * g - 38 * r + 0x8080) >> 8);
}
static __inline uint8_t RGBToV(uint8_t r, uint8_t g, uint8_t b) {
return STATIC_CAST(uint8_t, (112 * r - 94 * g - 18 * b + 0x8080) >> 8);
}
#endif
#if !defined(LIBYUV_ARGBTOUV_PAVGB)
static __inline int RGB2xToU(uint16_t r, uint16_t g, uint16_t b) {
return STATIC_CAST(
uint8_t, ((112 / 2) * b - (74 / 2) * g - (38 / 2) * r + 0x8080) >> 8);
}
static __inline int RGB2xToV(uint16_t r, uint16_t g, uint16_t b) {
return STATIC_CAST(
uint8_t, ((112 / 2) * r - (94 / 2) * g - (18 / 2) * b + 0x8080) >> 8);
}
#endif
#if defined(LIBYUV_ARGBTOUV_PAVGB)
#define MAKEROWY …
#else
#define MAKEROWY …
#endif
MAKEROWY(ARGB, 2, 1, 0, 4)
MAKEROWY(BGRA, 1, 2, 3, 4)
MAKEROWY(ABGR, 0, 1, 2, 4)
MAKEROWY(RGBA, 3, 2, 1, 4)
MAKEROWY(RGB24, 2, 1, 0, 3)
MAKEROWY(RAW, 0, 1, 2, 3)
#undef MAKEROWY
#ifdef LIBYUV_RGB7
static __inline uint8_t RGBToYJ(uint8_t r, uint8_t g, uint8_t b) {
return (38 * r + 75 * g + 15 * b + 64) >> 7;
}
#else
static __inline uint8_t RGBToYJ(uint8_t r, uint8_t g, uint8_t b) { … }
#endif
#if defined(LIBYUV_ARGBTOUV_PAVGB)
static __inline uint8_t RGBToUJ(uint8_t r, uint8_t g, uint8_t b) { … }
static __inline uint8_t RGBToVJ(uint8_t r, uint8_t g, uint8_t b) { … }
#else
static __inline uint8_t RGB2xToUJ(uint16_t r, uint16_t g, uint16_t b) {
return ((127 / 2) * b - (84 / 2) * g - (43 / 2) * r + 0x8080) >> 8;
}
static __inline uint8_t RGB2xToVJ(uint16_t r, uint16_t g, uint16_t b) {
return ((127 / 2) * r - (107 / 2) * g - (20 / 2) * b + 0x8080) >> 8;
}
#endif
#if defined(LIBYUV_ARGBTOUV_PAVGB)
#define MAKEROWYJ …
#else
#define MAKEROWYJ …
#endif
MAKEROWYJ(ARGB, 2, 1, 0, 4)
MAKEROWYJ(ABGR, 0, 1, 2, 4)
MAKEROWYJ(RGBA, 3, 2, 1, 4)
MAKEROWYJ(RGB24, 2, 1, 0, 3)
MAKEROWYJ(RAW, 0, 1, 2, 3)
#undef MAKEROWYJ
void RGB565ToYRow_C(const uint8_t* src_rgb565, uint8_t* dst_y, int width) { … }
void ARGB1555ToYRow_C(const uint8_t* src_argb1555, uint8_t* dst_y, int width) { … }
void ARGB4444ToYRow_C(const uint8_t* src_argb4444, uint8_t* dst_y, int width) { … }
void RGB565ToUVRow_C(const uint8_t* src_rgb565,
int src_stride_rgb565,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void ARGB1555ToUVRow_C(const uint8_t* src_argb1555,
int src_stride_argb1555,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void ARGB4444ToUVRow_C(const uint8_t* src_argb4444,
int src_stride_argb4444,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void ARGBToUV444Row_C(const uint8_t* src_argb,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void ARGBGrayRow_C(const uint8_t* src_argb, uint8_t* dst_argb, int width) { … }
void ARGBSepiaRow_C(uint8_t* dst_argb, int width) { … }
void ARGBColorMatrixRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
const int8_t* matrix_argb,
int width) { … }
void ARGBColorTableRow_C(uint8_t* dst_argb,
const uint8_t* table_argb,
int width) { … }
void RGBColorTableRow_C(uint8_t* dst_argb,
const uint8_t* table_argb,
int width) { … }
void ARGBQuantizeRow_C(uint8_t* dst_argb,
int scale,
int interval_size,
int interval_offset,
int width) { … }
#define REPEAT8 …
#define SHADE …
void ARGBShadeRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
int width,
uint32_t value) { … }
#undef REPEAT8
#undef SHADE
#define REPEAT8 …
#define SHADE …
void ARGBMultiplyRow_C(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width) { … }
#undef REPEAT8
#undef SHADE
#define SHADE …
void ARGBAddRow_C(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width) { … }
#undef SHADE
#define SHADE …
void ARGBSubtractRow_C(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width) { … }
#undef SHADE
void SobelXRow_C(const uint8_t* src_y0,
const uint8_t* src_y1,
const uint8_t* src_y2,
uint8_t* dst_sobelx,
int width) { … }
void SobelYRow_C(const uint8_t* src_y0,
const uint8_t* src_y1,
uint8_t* dst_sobely,
int width) { … }
void SobelRow_C(const uint8_t* src_sobelx,
const uint8_t* src_sobely,
uint8_t* dst_argb,
int width) { … }
void SobelToPlaneRow_C(const uint8_t* src_sobelx,
const uint8_t* src_sobely,
uint8_t* dst_y,
int width) { … }
void SobelXYRow_C(const uint8_t* src_sobelx,
const uint8_t* src_sobely,
uint8_t* dst_argb,
int width) { … }
void J400ToARGBRow_C(const uint8_t* src_y, uint8_t* dst_argb, int width) { … }
#if defined(__aarch64__) || defined(__arm__) || defined(__riscv)
#define YUVCONSTANTSBODY …
#else
#define YUVCONSTANTSBODY(YG, YB, UB, UG, VG, VR) …
#endif
#define MAKEYUVCONSTANTS …
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT601)
#define UB …
#else
#define UB …
#endif
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(I601, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#define UB …
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(JPEG, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT709)
#define UB …
#else
#define UB …
#endif
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(H709, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#define UB …
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(F709, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#if defined(LIBYUV_UNLIMITED_DATA) || defined(LIBYUV_UNLIMITED_BT2020)
#define UB …
#else
#define UB …
#endif
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(2020, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#define UB …
#define UG …
#define VG …
#define VR …
#define YG …
#define YB …
MAKEYUVCONSTANTS(V2020, YG, YB, UB, UG, VG, VR)
#undef YG
#undef YB
#undef UB
#undef UG
#undef VG
#undef VR
#undef BB
#undef BG
#undef BR
#undef MAKEYUVCONSTANTS
#if defined(__aarch64__) || defined(__arm__) || defined(__riscv)
#define LOAD_YUV_CONSTANTS …
#define CALC_RGB16 …
#else
#define LOAD_YUV_CONSTANTS …
#define CALC_RGB16 …
#endif
static __inline void YuvPixel(uint8_t y,
uint8_t u,
uint8_t v,
uint8_t* b,
uint8_t* g,
uint8_t* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel8_16(uint8_t y,
uint8_t u,
uint8_t v,
int* b,
int* g,
int* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel10_16(uint16_t y,
uint16_t u,
uint16_t v,
int* b,
int* g,
int* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel12_16(int16_t y,
int16_t u,
int16_t v,
int* b,
int* g,
int* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel10(uint16_t y,
uint16_t u,
uint16_t v,
uint8_t* b,
uint8_t* g,
uint8_t* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel12(uint16_t y,
uint16_t u,
uint16_t v,
uint8_t* b,
uint8_t* g,
uint8_t* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel16_8(uint16_t y,
uint16_t u,
uint16_t v,
uint8_t* b,
uint8_t* g,
uint8_t* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YuvPixel16_16(uint16_t y,
uint16_t u,
uint16_t v,
int* b,
int* g,
int* r,
const struct YuvConstants* yuvconstants) { … }
static __inline void YPixel(uint8_t y,
uint8_t* b,
uint8_t* g,
uint8_t* r,
const struct YuvConstants* yuvconstants) { … }
void I444ToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I444ToRGB24Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I210ToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I410ToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I210AlphaToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
const uint16_t* src_a,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I410AlphaToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
const uint16_t* src_a,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I212ToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
static void StoreAR30(uint8_t* rgb_buf, int b, int g, int r) { … }
void I210ToAR30Row_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I212ToAR30Row_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I410ToAR30Row_C(const uint16_t* src_y,
const uint16_t* src_u,
const uint16_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void P210ToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_uv,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width) { … }
void P410ToARGBRow_C(const uint16_t* src_y,
const uint16_t* src_uv,
uint8_t* dst_argb,
const struct YuvConstants* yuvconstants,
int width) { … }
void P210ToAR30Row_C(const uint16_t* src_y,
const uint16_t* src_uv,
uint8_t* dst_ar30,
const struct YuvConstants* yuvconstants,
int width) { … }
void P410ToAR30Row_C(const uint16_t* src_y,
const uint16_t* src_uv,
uint8_t* dst_ar30,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToAR30Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I444AlphaToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
const uint8_t* src_a,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422AlphaToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
const uint8_t* src_a,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToRGB24Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToARGB4444Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb4444,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToARGB1555Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb1555,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToRGB565Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
void NV12ToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void NV21ToARGBRow_C(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void NV12ToRGB24Row_C(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void NV21ToRGB24Row_C(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void NV12ToRGB565Row_C(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
void YUY2ToARGBRow_C(const uint8_t* src_yuy2,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void UYVYToARGBRow_C(const uint8_t* src_uyvy,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I422ToRGBARow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void I400ToARGBRow_C(const uint8_t* src_y,
uint8_t* rgb_buf,
const struct YuvConstants* yuvconstants,
int width) { … }
void MirrorRow_C(const uint8_t* src, uint8_t* dst, int width) { … }
void MirrorRow_16_C(const uint16_t* src, uint16_t* dst, int width) { … }
void MirrorUVRow_C(const uint8_t* src_uv, uint8_t* dst_uv, int width) { … }
void MirrorSplitUVRow_C(const uint8_t* src_uv,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void ARGBMirrorRow_C(const uint8_t* src, uint8_t* dst, int width) { … }
void RGB24MirrorRow_C(const uint8_t* src_rgb24, uint8_t* dst_rgb24, int width) { … }
void SplitUVRow_C(const uint8_t* src_uv,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void MergeUVRow_C(const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_uv,
int width) { … }
void DetileRow_C(const uint8_t* src,
ptrdiff_t src_tile_stride,
uint8_t* dst,
int width) { … }
void DetileRow_16_C(const uint16_t* src,
ptrdiff_t src_tile_stride,
uint16_t* dst,
int width) { … }
void DetileSplitUVRow_C(const uint8_t* src_uv,
ptrdiff_t src_tile_stride,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void DetileToYUY2_C(const uint8_t* src_y,
ptrdiff_t src_y_tile_stride,
const uint8_t* src_uv,
ptrdiff_t src_uv_tile_stride,
uint8_t* dst_yuy2,
int width) { … }
void UnpackMT2T_C(const uint8_t* src, uint16_t* dst, size_t size) { … }
void SplitRGBRow_C(const uint8_t* src_rgb,
uint8_t* dst_r,
uint8_t* dst_g,
uint8_t* dst_b,
int width) { … }
void MergeRGBRow_C(const uint8_t* src_r,
const uint8_t* src_g,
const uint8_t* src_b,
uint8_t* dst_rgb,
int width) { … }
void SplitARGBRow_C(const uint8_t* src_argb,
uint8_t* dst_r,
uint8_t* dst_g,
uint8_t* dst_b,
uint8_t* dst_a,
int width) { … }
void MergeARGBRow_C(const uint8_t* src_r,
const uint8_t* src_g,
const uint8_t* src_b,
const uint8_t* src_a,
uint8_t* dst_argb,
int width) { … }
void MergeXR30Row_C(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
uint8_t* dst_ar30,
int depth,
int width) { … }
void MergeAR64Row_C(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
const uint16_t* src_a,
uint16_t* dst_ar64,
int depth,
int width) { … }
void MergeARGB16To8Row_C(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
const uint16_t* src_a,
uint8_t* dst_argb,
int depth,
int width) { … }
void MergeXR64Row_C(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
uint16_t* dst_ar64,
int depth,
int width) { … }
void MergeXRGB16To8Row_C(const uint16_t* src_r,
const uint16_t* src_g,
const uint16_t* src_b,
uint8_t* dst_argb,
int depth,
int width) { … }
void SplitXRGBRow_C(const uint8_t* src_argb,
uint8_t* dst_r,
uint8_t* dst_g,
uint8_t* dst_b,
int width) { … }
void MergeXRGBRow_C(const uint8_t* src_r,
const uint8_t* src_g,
const uint8_t* src_b,
uint8_t* dst_argb,
int width) { … }
void MergeUVRow_16_C(const uint16_t* src_u,
const uint16_t* src_v,
uint16_t* dst_uv,
int depth,
int width) { … }
void SplitUVRow_16_C(const uint16_t* src_uv,
uint16_t* dst_u,
uint16_t* dst_v,
int depth,
int width) { … }
void MultiplyRow_16_C(const uint16_t* src_y,
uint16_t* dst_y,
int scale,
int width) { … }
void DivideRow_16_C(const uint16_t* src_y,
uint16_t* dst_y,
int scale,
int width) { … }
#define C16TO8(v, scale) …
void Convert16To8Row_C(const uint16_t* src_y,
uint8_t* dst_y,
int scale,
int width) { … }
void Convert8To16Row_C(const uint8_t* src_y,
uint16_t* dst_y,
int scale,
int width) { … }
void CopyRow_C(const uint8_t* src, uint8_t* dst, int count) { … }
void CopyRow_16_C(const uint16_t* src, uint16_t* dst, int count) { … }
void SetRow_C(uint8_t* dst, uint8_t v8, int width) { … }
void ARGBSetRow_C(uint8_t* dst_argb, uint32_t v32, int width) { … }
void YUY2ToUVRow_C(const uint8_t* src_yuy2,
int src_stride_yuy2,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void YUY2ToNVUVRow_C(const uint8_t* src_yuy2,
int src_stride_yuy2,
uint8_t* dst_uv,
int width) { … }
void YUY2ToUV422Row_C(const uint8_t* src_yuy2,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void YUY2ToYRow_C(const uint8_t* src_yuy2, uint8_t* dst_y, int width) { … }
void UYVYToUVRow_C(const uint8_t* src_uyvy,
int src_stride_uyvy,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void UYVYToUV422Row_C(const uint8_t* src_uyvy,
uint8_t* dst_u,
uint8_t* dst_v,
int width) { … }
void UYVYToYRow_C(const uint8_t* src_uyvy, uint8_t* dst_y, int width) { … }
#define BLEND …
void ARGBBlendRow_C(const uint8_t* src_argb,
const uint8_t* src_argb1,
uint8_t* dst_argb,
int width) { … }
#undef BLEND
#define UBLEND …
void BlendPlaneRow_C(const uint8_t* src0,
const uint8_t* src1,
const uint8_t* alpha,
uint8_t* dst,
int width) { … }
#undef UBLEND
#define ATTENUATE …
void ARGBAttenuateRow_C(const uint8_t* src_argb, uint8_t* dst_argb, int width) { … }
#undef ATTENUATE
#define T …
const uint32_t fixed_invtbl8[256] = …;
#undef T
#if defined(LIBYUV_UNATTENUATE_DUP)
#define UNATTENUATE …
#else
#define UNATTENUATE(f, ia) …
#endif
void ARGBUnattenuateRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
int width) { … }
void ComputeCumulativeSumRow_C(const uint8_t* row,
int32_t* cumsum,
const int32_t* previous_cumsum,
int width) { … }
void CumulativeSumToAverageRow_C(const int32_t* tl,
const int32_t* bl,
int w,
int area,
uint8_t* dst,
int count) { … }
LIBYUV_API
void ARGBAffineRow_C(const uint8_t* src_argb,
int src_argb_stride,
uint8_t* dst_argb,
const float* uv_dudv,
int width) { … }
static void HalfRow_C(const uint8_t* src_uv,
ptrdiff_t src_uv_stride,
uint8_t* dst_uv,
int width) { … }
static void HalfRow_16_C(const uint16_t* src_uv,
ptrdiff_t src_uv_stride,
uint16_t* dst_uv,
int width) { … }
static void HalfRow_16To8_C(const uint16_t* src_uv,
ptrdiff_t src_uv_stride,
uint8_t* dst_uv,
int scale,
int width) { … }
void InterpolateRow_C(uint8_t* dst_ptr,
const uint8_t* src_ptr,
ptrdiff_t src_stride,
int width,
int source_y_fraction) { … }
void InterpolateRow_16_C(uint16_t* dst_ptr,
const uint16_t* src_ptr,
ptrdiff_t src_stride,
int width,
int source_y_fraction) { … }
void InterpolateRow_16To8_C(uint8_t* dst_ptr,
const uint16_t* src_ptr,
ptrdiff_t src_stride,
int scale,
int width,
int source_y_fraction) { … }
void ARGBShuffleRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
const uint8_t* shuffler,
int width) { … }
void I422ToYUY2Row_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_frame,
int width) { … }
void I422ToUYVYRow_C(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_frame,
int width) { … }
void ARGBPolynomialRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
const float* poly,
int width) { … }
#if defined(__GNUC__)
uint32_alias_t;
#else
typedef uint32_t uint32_alias_t;
#endif
void HalfFloatRow_C(const uint16_t* src,
uint16_t* dst,
float scale,
int width) { … }
void ByteToFloatRow_C(const uint8_t* src, float* dst, float scale, int width) { … }
void ARGBLumaColorTableRow_C(const uint8_t* src_argb,
uint8_t* dst_argb,
int width,
const uint8_t* luma,
uint32_t lumacoeff) { … }
void ARGBCopyAlphaRow_C(const uint8_t* src, uint8_t* dst, int width) { … }
void ARGBExtractAlphaRow_C(const uint8_t* src_argb, uint8_t* dst_a, int width) { … }
void ARGBCopyYToAlphaRow_C(const uint8_t* src, uint8_t* dst, int width) { … }
#define MAXTWIDTH …
#if !(defined(_MSC_VER) && !defined(__clang__) && defined(_M_IX86)) && \
defined(HAS_I422TORGB565ROW_SSSE3)
void I422ToRGB565Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TOARGB1555ROW_SSSE3)
void I422ToARGB1555Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb1555,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TOARGB4444ROW_SSSE3)
void I422ToARGB4444Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb4444,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV12TORGB565ROW_SSSE3)
void NV12ToRGB565Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV12TORGB24ROW_SSSE3)
void NV12ToRGB24Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV21TORGB24ROW_SSSE3)
void NV21ToRGB24Row_SSSE3(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV12TORGB24ROW_AVX2)
void NV12ToRGB24Row_AVX2(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV21TORGB24ROW_AVX2)
void NV21ToRGB24Row_AVX2(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TORGB565ROW_AVX2)
void I422ToRGB565Row_AVX2(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TOARGB1555ROW_AVX2)
void I422ToARGB1555Row_AVX2(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb1555,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TOARGB4444ROW_AVX2)
void I422ToARGB4444Row_AVX2(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_argb4444,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I422TORGB24ROW_AVX2)
void I422ToRGB24Row_AVX2(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_I444TORGB24ROW_AVX2)
void I444ToRGB24Row_AVX2(const uint8_t* src_y,
const uint8_t* src_u,
const uint8_t* src_v,
uint8_t* dst_rgb24,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#if defined(HAS_NV12TORGB565ROW_AVX2)
void NV12ToRGB565Row_AVX2(const uint8_t* src_y,
const uint8_t* src_uv,
uint8_t* dst_rgb565,
const struct YuvConstants* yuvconstants,
int width) { … }
#endif
#ifdef HAS_RGB24TOYJROW_AVX2
void RGB24ToYJRow_AVX2(const uint8_t* src_rgb24, uint8_t* dst_yj, int width) { … }
#endif
#ifdef HAS_RAWTOYJROW_AVX2
void RAWToYJRow_AVX2(const uint8_t* src_raw, uint8_t* dst_yj, int width) { … }
#endif
#ifdef HAS_RGB24TOYJROW_SSSE3
void RGB24ToYJRow_SSSE3(const uint8_t* src_rgb24, uint8_t* dst_yj, int width) { … }
#endif
#ifdef HAS_RAWTOYJROW_SSSE3
void RAWToYJRow_SSSE3(const uint8_t* src_raw, uint8_t* dst_yj, int width) { … }
#endif
#ifdef HAS_INTERPOLATEROW_16TO8_AVX2
void InterpolateRow_16To8_AVX2(uint8_t* dst_ptr,
const uint16_t* src_ptr,
ptrdiff_t src_stride,
int scale,
int width,
int source_y_fraction) { … }
#endif
float ScaleSumSamples_C(const float* src, float* dst, float scale, int width) { … }
float ScaleMaxSamples_C(const float* src, float* dst, float scale, int width) { … }
void ScaleSamples_C(const float* src, float* dst, float scale, int width) { … }
void GaussRow_C(const uint32_t* src, uint16_t* dst, int width) { … }
void GaussCol_C(const uint16_t* src0,
const uint16_t* src1,
const uint16_t* src2,
const uint16_t* src3,
const uint16_t* src4,
uint32_t* dst,
int width) { … }
void GaussRow_F32_C(const float* src, float* dst, int width) { … }
void GaussCol_F32_C(const float* src0,
const float* src1,
const float* src2,
const float* src3,
const float* src4,
float* dst,
int width) { … }
void NV21ToYUV24Row_C(const uint8_t* src_y,
const uint8_t* src_vu,
uint8_t* dst_yuv24,
int width) { … }
void AYUVToUVRow_C(const uint8_t* src_ayuv,
int src_stride_ayuv,
uint8_t* dst_uv,
int width) { … }
void AYUVToVURow_C(const uint8_t* src_ayuv,
int src_stride_ayuv,
uint8_t* dst_vu,
int width) { … }
void AYUVToYRow_C(const uint8_t* src_ayuv, uint8_t* dst_y, int width) { … }
void SwapUVRow_C(const uint8_t* src_uv, uint8_t* dst_vu, int width) { … }
void HalfMergeUVRow_C(const uint8_t* src_u,
int src_stride_u,
const uint8_t* src_v,
int src_stride_v,
uint8_t* dst_uv,
int width) { … }
#undef STATIC_CAST
#ifdef __cplusplus
}
}
#endif