Merge commit '852f2a6343518919e5ca8d3c1bbcab9f493e3cd8'

This commit is contained in:
2024-01-17 17:02:59 +01:00
1244 changed files with 50102 additions and 28146 deletions

View File

@@ -31,6 +31,11 @@ typedef struct
// |G| = 1/PRECISION_FACTOR * |y_factor u_g_factor v_g_factor| * | U-128 |
// |B| |y_factor u_b_factor 0 | | V-128 |
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 26451)
#endif
#define V(value) (int16_t)((value*PRECISION_FACTOR)+0.5)
// for ITU-T T.871, values can be found in section 7
@@ -56,6 +61,10 @@ static const RGB2YUVParam RGB2YUV[3] = {
{/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}}
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/* The various layouts of YUV data we support */
#define YUV_FORMAT_420 1
#define YUV_FORMAT_422 2

View File

@@ -69,10 +69,15 @@
#endif
#ifdef _MSC_VER /* Visual Studio analyzer can't tell that we're building this with different constants */
#pragma warning(push)
#pragma warning(disable : 6239)
#endif
void STD_FUNCTION_NAME(
uint32_t width, uint32_t height,
const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
uint8_t *RGB, uint32_t RGB_stride,
uint32_t width, uint32_t height,
const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride,
uint8_t *RGB, uint32_t RGB_stride,
YCbCrType yuv_type)
{
const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]);
@@ -113,26 +118,26 @@ void STD_FUNCTION_NAME(
for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
{
// Compute U and V contributions, common to the four pixels
int32_t u_tmp = ((*u_ptr)-128);
int32_t v_tmp = ((*v_ptr)-128);
int32_t r_tmp = (v_tmp*param->v_r_factor);
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
int32_t b_tmp = (u_tmp*param->u_b_factor);
// Compute the Y contribution for each pixel
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
#if uv_y_sample_interval > 1
y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr2);
y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr2);
#endif
@@ -149,19 +154,19 @@ void STD_FUNCTION_NAME(
if (uv_x_sample_interval == 2 && x == (width-1))
{
// Compute U and V contributions, common to the four pixels
int32_t u_tmp = ((*u_ptr)-128);
int32_t v_tmp = ((*v_ptr)-128);
int32_t r_tmp = (v_tmp*param->v_r_factor);
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
int32_t b_tmp = (u_tmp*param->u_b_factor);
// Compute the Y contribution for each pixel
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
#if uv_y_sample_interval > 1
y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr2);
@@ -175,28 +180,28 @@ void STD_FUNCTION_NAME(
const uint8_t *y_ptr1=Y+y*Y_stride,
*u_ptr=U+(y/uv_y_sample_interval)*UV_stride,
*v_ptr=V+(y/uv_y_sample_interval)*UV_stride;
uint8_t *rgb_ptr1=RGB+y*RGB_stride;
for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval)
{
// Compute U and V contributions, common to the four pixels
int32_t u_tmp = ((*u_ptr)-128);
int32_t v_tmp = ((*v_ptr)-128);
int32_t r_tmp = (v_tmp*param->v_r_factor);
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
int32_t b_tmp = (u_tmp*param->u_b_factor);
// Compute the Y contribution for each pixel
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
y_ptr1+=2*y_pixel_stride;
u_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
v_ptr+=2*uv_pixel_stride/uv_x_sample_interval;
@@ -206,16 +211,16 @@ void STD_FUNCTION_NAME(
if (uv_x_sample_interval == 2 && x == (width-1))
{
// Compute U and V contributions, common to the four pixels
int32_t u_tmp = ((*u_ptr)-128);
int32_t v_tmp = ((*v_ptr)-128);
int32_t r_tmp = (v_tmp*param->v_r_factor);
int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor);
int32_t b_tmp = (u_tmp*param->u_b_factor);
// Compute the Y contribution for each pixel
int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor);
PACK_PIXEL(rgb_ptr1);
}
@@ -227,6 +232,10 @@ void STD_FUNCTION_NAME(
#undef uv_y_sample_interval
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
#undef STD_FUNCTION_NAME
#undef YUV_FORMAT
#undef RGB_FORMAT